Browse Source

Generate color scheme locally

crash2
Geoffrey Frogeye 1 year ago
parent
commit
af25d342e8
Signed by: geoffrey GPG Key ID: C72403E7F82E6AD8
  1. 3
      .gitmodules
  2. 2
      config/alacritty/alacritty.yml.j2
  3. 10
      config/automatrop/README.md
  4. 4
      config/automatrop/ansible.cfg
  5. 2
      config/automatrop/playbooks/default.yml
  6. 72
      config/automatrop/roles/color/tasks/main.yml
  7. 1
      config/automatrop/roles/mnussbaum.base16-builder-ansible
  8. 2
      config/dunst/dunstrc.j2
  9. 2
      config/i3/config.j2
  10. 1
      termux/.gitignore
  11. 26
      termux/color.properties
  12. 29
      termux/colors.properties

3
.gitmodules

@ -0,0 +1,3 @@
[submodule "config/automatrop/roles/mnussbaum.base16-builder-ansible"]
path = config/automatrop/roles/mnussbaum.base16-builder-ansible
url = https://github.com/GeoffreyFrogeye/base16-builder-ansible.git

2
config/alacritty/alacritty.yml.j2

@ -160,7 +160,7 @@ font:
# it is recommended to set `use_thin_strokes` to `false`.
#use_thin_strokes: true
{{ lookup('file', ansible_env.HOME + '/.config/alacritty/theme.yml') }}
{{ base16_schemes['schemes'][base16_scheme]['alacritty']['colors']['base16-' + base16_scheme + '.yml'] }}
# Bell
#

10
config/automatrop/README.md

@ -0,0 +1,10 @@
# Automatrop
Because I'm getting tired of too many bash scripts and yet using Ansible seems
overkill at the same time.
## Dependencies
```bash
ansible-galaxy install mnussbaum.base16-builder-ansible
```

4
config/automatrop/ansible.cfg

@ -1,3 +1,7 @@
[defaults]
inventory=hosts
roles_path=roles
interpreter_python=auto
[ssh_connection]
pipelining = True # does not work with requiretty in /etc/sudoers

2
config/automatrop/playbooks/default.yml

@ -2,4 +2,6 @@
hosts: localhost
connection: local
roles:
- role: mnussbaum.base16-builder-ansible # Required for color
- role: color

72
config/automatrop/roles/color/tasks/main.yml

@ -9,20 +9,31 @@
- ".config/qutebrowser"
- ".config/tridactyl/themes"
- name: Download base16 theme for Xresources
get_url:
url: "https://raw.githubusercontent.com/chriskempson/base16-xresources/master/xresources/base16-{{ base16_scheme }}-256.Xresources"
# Build a single color scheme and template and assign it to a variable
- base16_builder:
scheme: "{{ base16_scheme }}"
template: # This requires https://github.com/mnussbaum/base16-builder-ansible/pull/6
- i3
- xresources
- rofi
- termux
- alacritty
- shell
- fzf
- vim
- qutebrowser
- tridactyl
- dunst
register: base16_schemes
- name: Set base16 theme for Xresources
copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['xresources']['xresources']['base16-' + base16_scheme + '-256.Xresources'] }}"
dest: "{{ ansible_env.HOME }}/.config/Xresources/theme"
mode: "u+rw,g=r,o=r"
notify:
- xrdb-reload
- name: Download base16 theme for i3
get_url:
url: "https://raw.githubusercontent.com/khamer/base16-i3/master/colors/base16-{{ base16_scheme }}.config"
dest: "{{ ansible_env.HOME }}/.config/i3/theme"
mode: "u+rw,g=r,o=r"
- name: Configure i3
template:
src: "{{ ansible_env.HOME }}/.config/i3/config.j2"
@ -31,9 +42,9 @@
notify:
- i3-reload
- name: Download base16 theme for rofi
get_url:
url: "https://raw.githubusercontent.com/0xdec/base16-rofi/master/themes/base16-{{ base16_scheme }}.{{ item }}"
- name: Set base16 theme for rofi
copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}"
dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}"
mode: "u+rw,g=r,o=r"
with_items:
@ -41,28 +52,23 @@
- config
- name: Download base16 theme for Termux
get_url:
url: "https://raw.githubusercontent.com/kdrag0n/base16-termux/master/colors/base16-{{ base16_scheme }}.properties"
dest: "{{ ansible_env.HOME }}/.termux/color.properties"
copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}"
dest: "{{ ansible_env.HOME }}/.termux/colors.properties"
mode: "u+rw,g=r,o=r"
# TODO Only on Termux
- name: Download base16 theme for Alacritty
get_url:
url: "https://raw.githubusercontent.com/aaron-williamson/base16-alacritty/master/colors/base16-{{ base16_scheme }}.yml"
dest: "{{ ansible_env.HOME }}/.config/alacritty/theme.yml"
mode: "u+rw,g=r,o=r"
- name: Configure Alacritty
template:
src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2"
dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml"
mode: "u+rw,g=r,o=r"
# Alacritty has live config reload, so no command to execute
# However, it doesn't work with yaml includes, hence the template
- name: Download base16 theme for shell
get_url:
url: "https://raw.githubusercontent.com/chriskempson/base16-shell/master/scripts/base16-{{ base16_scheme }}.sh"
copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
mode: "u+rwx,g=rx,o=rx"
notify:
@ -70,8 +76,8 @@
when: False # Not currently used
- name: Download base16 theme for fzf
get_url:
url: "https://raw.githubusercontent.com/nicodebo/base16-fzf/master/bash/base16-{{ base16_scheme }}.config"
copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf"
mode: "u+rw,g=r,o=r"
notify:
@ -85,33 +91,27 @@
when: False # Not currently used
- name: Download base16 theme for qutebrowser
get_url:
url: "https://raw.githubusercontent.com/theova/base16-qutebrowser/main/themes/default/base16-{{ base16_scheme }}.config.py"
copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['qutebrowser']['themes/minimal']['base16-' + base16_scheme + '.config.py'] }}"
dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py"
mode: "u+rw,g=r,o=r"
notify:
- qutebrowser-reload
- name: Download base16 theme for Tridactyl
get_url:
url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css"
copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['tridactyl']['base16-' + base16_scheme + '.config.py'] }}"
# url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css"
dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css"
mode: "u+rw,g=r,o=r"
when: False # Not currently used
- name: Download base16 theme for Dunst
get_url:
url: "https://raw.githubusercontent.com/khamer/base16-dunst/master/themes/base16-{{ base16_scheme }}.dunstrc"
dest: "{{ ansible_env.HOME }}/.config/dunst/theme"
mode: "u+rw,g=r,o=r"
- name: Configure Dunst
template:
src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2"
dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc"
mode: "u+rw,g=r,o=r"
# TODO Generate themes locally because not being able to switch themes because GitHub being down is just silly
# TODO bar (might change bar in the future, so...)
# TODO highlight (there IS a template but the colors look different from vim and mostly the same from when there's no config)
# TODO https://github.com/makuto/auto-base16-theme ? :P

1
config/automatrop/roles/mnussbaum.base16-builder-ansible

@ -0,0 +1 @@
Subproject commit f63161458533d5dc1a75529fb4e1fb04bc6885e6

2
config/dunst/dunstrc.j2

@ -61,5 +61,5 @@
foreground = "#F8F8F2"
frame_color = "#F92672"
timeout = 0
{{ lookup('file', ansible_env.HOME + '/.config/dunst/theme') }}
{{ base16_schemes['schemes'][base16_scheme]['dunst']['themes']['base16-' + base16_scheme + '.dunstrc'] }}
# TODO Not used. Not sure how it's supposed to be used :D

2
config/i3/config.j2

@ -384,7 +384,7 @@ exec --no-startup-id ~/.config/i3/batteryNotify -d # Battery state notification
# exec --no-startup-id ~/.config/i3/aw_start # Activity tracker
{{ lookup('file', ansible_env.HOME + '/.config/i3/theme') }}
{{ base16_schemes['schemes'][base16_scheme]['i3']['colors']['base16-' + base16_scheme + '.config'] }}
set $ignore #ff00ff
# Basic color configuration using the Base16 variables for windows and borders.

1
termux/.gitignore

@ -0,0 +1 @@
colors.properties

26
termux/color.properties

@ -1,26 +0,0 @@
# Base16 Solarized Light - Termux color config
# Scheme by Ethan Schoonover (modified by aramisgithub)
background=#fdf6e3
foreground=#586e75
cursor=#586e75
# normal
color0=#fdf6e3
color1=#dc322f
color2=#859900
color3=#b58900
color4=#268bd2
color5=#6c71c4
color6=#2aa198
color7=#586e75
# bright
color8=#839496
color9=#cb4b16
color10=#eee8d5
color11=#93a1a1
color12=#657b83
color13=#073642
color14=#d33682
color15=#002b36

29
termux/colors.properties

@ -1,29 +0,0 @@
# https://github.com/chriskempson/base16-xresources/blob/master/base16-monokai.dark.256.xresources
foreground= #f8f8f2
background= #272822
cursor= #f8f8f2
color0= #272822
color1= #f92672
color2= #a6e22e
color3= #f4bf75
color4= #66d9ef
color5= #ae81ff
color6= #a1efe4
color7= #f8f8f2
color8= #75715e
color9= #f92672
color10= #a6e22e
color11= #f4bf75
color12= #66d9ef
color13= #ae81ff
color14= #a1efe4
color15= #f9f8f5
color16= #fd971f
color17= #ae81ff
color18= #383830
color19= #49483e
color20= #a59f85
color21= #f5f4f1
Loading…
Cancel
Save