Generate color scheme locally

This commit is contained in:
Geoffrey Frogeye 2021-01-09 18:58:18 +01:00
parent 709239dfca
commit af25d342e8
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
12 changed files with 60 additions and 94 deletions

3
.gitmodules vendored Normal file
View file

@ -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

View file

@ -160,7 +160,7 @@ font:
# it is recommended to set `use_thin_strokes` to `false`. # it is recommended to set `use_thin_strokes` to `false`.
#use_thin_strokes: true #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 # Bell
# #

View file

@ -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
```

View file

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

View file

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

View file

@ -9,20 +9,31 @@
- ".config/qutebrowser" - ".config/qutebrowser"
- ".config/tridactyl/themes" - ".config/tridactyl/themes"
- name: Download base16 theme for Xresources # Build a single color scheme and template and assign it to a variable
get_url: - base16_builder:
url: "https://raw.githubusercontent.com/chriskempson/base16-xresources/master/xresources/base16-{{ base16_scheme }}-256.Xresources" 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" dest: "{{ ansible_env.HOME }}/.config/Xresources/theme"
mode: "u+rw,g=r,o=r" mode: "u+rw,g=r,o=r"
notify: notify:
- xrdb-reload - 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 - name: Configure i3
template: template:
src: "{{ ansible_env.HOME }}/.config/i3/config.j2" src: "{{ ansible_env.HOME }}/.config/i3/config.j2"
@ -31,9 +42,9 @@
notify: notify:
- i3-reload - i3-reload
- name: Download base16 theme for rofi - name: Set base16 theme for rofi
get_url: copy:
url: "https://raw.githubusercontent.com/0xdec/base16-rofi/master/themes/base16-{{ base16_scheme }}.{{ item }}" content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}"
dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}" dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}"
mode: "u+rw,g=r,o=r" mode: "u+rw,g=r,o=r"
with_items: with_items:
@ -41,28 +52,23 @@
- config - config
- name: Download base16 theme for Termux - name: Download base16 theme for Termux
get_url: copy:
url: "https://raw.githubusercontent.com/kdrag0n/base16-termux/master/colors/base16-{{ base16_scheme }}.properties" content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}"
dest: "{{ ansible_env.HOME }}/.termux/color.properties" dest: "{{ ansible_env.HOME }}/.termux/colors.properties"
mode: "u+rw,g=r,o=r" mode: "u+rw,g=r,o=r"
# TODO Only on Termux # 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 - name: Configure Alacritty
template: template:
src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2" src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2"
dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml" dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml"
mode: "u+rw,g=r,o=r" mode: "u+rw,g=r,o=r"
# Alacritty has live config reload, so no command to execute # 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 - name: Download base16 theme for shell
get_url: copy:
url: "https://raw.githubusercontent.com/chriskempson/base16-shell/master/scripts/base16-{{ base16_scheme }}.sh" content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
mode: "u+rwx,g=rx,o=rx" mode: "u+rwx,g=rx,o=rx"
notify: notify:
@ -70,8 +76,8 @@
when: False # Not currently used when: False # Not currently used
- name: Download base16 theme for fzf - name: Download base16 theme for fzf
get_url: copy:
url: "https://raw.githubusercontent.com/nicodebo/base16-fzf/master/bash/base16-{{ base16_scheme }}.config" content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf" dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf"
mode: "u+rw,g=r,o=r" mode: "u+rw,g=r,o=r"
notify: notify:
@ -85,33 +91,27 @@
when: False # Not currently used when: False # Not currently used
- name: Download base16 theme for qutebrowser - name: Download base16 theme for qutebrowser
get_url: copy:
url: "https://raw.githubusercontent.com/theova/base16-qutebrowser/main/themes/default/base16-{{ base16_scheme }}.config.py" content: "{{ base16_schemes['schemes'][base16_scheme]['qutebrowser']['themes/minimal']['base16-' + base16_scheme + '.config.py'] }}"
dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py" dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py"
mode: "u+rw,g=r,o=r" mode: "u+rw,g=r,o=r"
notify: notify:
- qutebrowser-reload - qutebrowser-reload
- name: Download base16 theme for Tridactyl - name: Download base16 theme for Tridactyl
get_url: copy:
url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css" 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" dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css"
mode: "u+rw,g=r,o=r" mode: "u+rw,g=r,o=r"
when: False # Not currently used 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 - name: Configure Dunst
template: template:
src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2" src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2"
dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc" dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc"
mode: "u+rw,g=r,o=r" 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 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 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 # TODO https://github.com/makuto/auto-base16-theme ? :P

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

View file

@ -61,5 +61,5 @@
foreground = "#F8F8F2" foreground = "#F8F8F2"
frame_color = "#F92672" frame_color = "#F92672"
timeout = 0 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 # TODO Not used. Not sure how it's supposed to be used :D

View file

@ -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 # 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 set $ignore #ff00ff
# Basic color configuration using the Base16 variables for windows and borders. # Basic color configuration using the Base16 variables for windows and borders.

1
termux/.gitignore vendored Normal file
View file

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

View file

@ -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

View file

@ -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