diff options
-rw-r--r-- | .cache/wal/chromium/bg-dark.png | bin | 275 -> 0 bytes | |||
-rw-r--r-- | .cache/wal/chromium/bg-light.png | bin | 285 -> 0 bytes | |||
-rw-r--r-- | .cache/wal/chromium/manifest-dark.json | 32 | ||||
-rw-r--r-- | .cache/wal/chromium/manifest-light.json | 29 | ||||
-rwxr-xr-x | .local/share/bin/mode | 59 |
5 files changed, 57 insertions, 63 deletions
diff --git a/.cache/wal/chromium/bg-dark.png b/.cache/wal/chromium/bg-dark.png Binary files differdeleted file mode 100644 index 46227a9..0000000 --- a/.cache/wal/chromium/bg-dark.png +++ /dev/null diff --git a/.cache/wal/chromium/bg-light.png b/.cache/wal/chromium/bg-light.png Binary files differdeleted file mode 100644 index 1eeca16..0000000 --- a/.cache/wal/chromium/bg-light.png +++ /dev/null diff --git a/.cache/wal/chromium/manifest-dark.json b/.cache/wal/chromium/manifest-dark.json deleted file mode 100644 index 529b863..0000000 --- a/.cache/wal/chromium/manifest-dark.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "description": "Colorscheme generated by jswal", - "manifest_version": 2, - "name": "pywal", - "theme": { - "images": { "theme_frame": "bg.png" }, - "colors": { - "frame": [ 15, 20, 25 ], - "button_background": [ 255, 255, 255 ], - "ntp_background": [ 15, 20, 25 ], - "ntp_text": [ 15, 20, 25 ], - "toolbar": [ 23, 28, 36 ], - "tab_background_text": [ 73, 81, 98 ], - "tab_background_text_inactive": [ 73, 81, 98 ], - "tab_background_text_incognito": [ 73, 81, 98 ], - "tab_background_text_incognito_inactive": [ 73, 81, 98 ], - "bookmark_text": [ 248, 248, 240 ], - "tab_text": [ 248, 248, 240 ] - }, - "tints": { - "buttons": [ - 0.5461538461538459, - 29.279279279279276, - 87.05882352941177 - ], - "frame_inactive": [ -1, -1, -1 ], - "frame_incognito": [ -1, -1, -1 ], - "frame_incognito_inactive": [ -1, -1, -1 ] - } - }, - "version": "2" -} diff --git a/.cache/wal/chromium/manifest-light.json b/.cache/wal/chromium/manifest-light.json deleted file mode 100644 index 1c630db..0000000 --- a/.cache/wal/chromium/manifest-light.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "description": "Colorscheme generated by jswal", - "manifest_version": 2, - "name": "pywal", - "theme": { - "images": { "theme_frame": "bg.png" }, - "colors": { - "bookmark_text": [ 18, 18, 19 ], - "frame": [ 253, 249, 247 ], - "ntp_background": [ 253, 249, 247 ], - "ntp_text": [ 253, 249, 247 ], - "tab_background_text": [ 18, 18, 19 ], - "tab_background_text_inactive": [ 18, 18, 19 ], - "tab_background_text_incognito": [ 18, 18, 19 ], - "tab_background_text_incognito_inactive": [ 18, 18, 19 ], - "tab_text": [ 18, 18, 19 ], - "toolbar": [ 253, 249, 247 ], - "button_background": [ 255, 255, 255 ] - }, - "tints": { - "buttons": [ 0.5461538461538459, 29.279279279279276, - 87.05882352941177 ], - "frame_inactive": [ -1, -1, -1 ], - "frame_incognito": [ -1, -1, -1 ], - "frame_incognito_inactive": [ -1, -1, -1 ] - } - }, - "version": "2" -} diff --git a/.local/share/bin/mode b/.local/share/bin/mode index 654f0fe..fdec7e6 100755 --- a/.local/share/bin/mode +++ b/.local/share/bin/mode @@ -6,6 +6,28 @@ get_color() { xrdb -query | grep $1 | head -n1 | cut -f2 } +hex_to_rgb_array() { + printf "%d\n%d\n%d\n" "0x${1:1:2}" "0x${1:3:2}" "0x${1:5:2}" | jq -jc --slurp '.' +} + +get_color_rgb_array() { + hex_to_rgb_array "`get_color $1`" +} + +mix_rgb() { + R1="`printf "%d" "0x${1:1:2}"`" + G1="`printf "%d" "0x${1:3:2}"`" + B1="`printf "%d" "0x${1:5:2}"`" + R2="`printf "%d" "0x${2:1:2}"`" + G2="`printf "%d" "0x${2:3:2}"`" + B2="`printf "%d" "0x${2:5:2}"`" + + printf "#" + dc -e"$R1 $3 * $R2 1 $3 - * + 1 / p" | xargs printf "%02x" + dc -e"$G1 $3 * $G2 1 $3 - * + 1 / p" | xargs printf "%02x" + dc -e"$B1 $3 * $B2 1 $3 - * + 1 / p" | xargs printf "%02x" +} + switch_xrdb() { cat ~/.config/X11/base ~/.config/X11/$1 | xrdb } @@ -132,8 +154,41 @@ EOF switch_chrome() { cd ~/.cache/wal/chromium rm -f Cached Theme.pak bg.png manifest.json - ln -sf "bg-$1.png" bg.png - ln -sf "manifest-$1.json" manifest.json + convert -size 100x100 "xc:`get_color background`" bg.png + BG_ALT=$(mix_rgb $(get_color color8) $(get_color color0) '0.2') + jq -nc \ + --argjson bg "`get_color_rgb_array color0`" \ + --argjson bg_alt "`hex_to_rgb_array $BG_ALT`" \ + --argjson fg "`get_color_rgb_array color7`" \ + --argjson fg_alt "`get_color_rgb_array color8`" \ + '{ + "description": "colorscheme generated by mode", + "manifest_version": 2, + "name": "mode theme", + "theme": { + "images": { "theme_frame": "bg.png" }, + "colors": { + "frame": $bg, + "button_background": $fg, + "ntp_background": $bg, + "ntp_text": $bg, + "toolbar": $bg_alt, + "tab_background_text": $fg_alt, + "tab_background_text_inactive": $fg_alt, + "tab_background_text_incognito": $fg_alt, + "tab_background_text_incognito_inactive": $fg_alt, + "bookmark_text": $fg, + "tab_text": $fg + }, + "tints": { + "buttons": [ -1, -1, -1 ], + "frame_inactive": [ -1, -1, -1 ], + "frame_incognito": [ -1, -1, -1 ], + "frame_incognito_inactive": [ -1, -1, -1 ] + } + }, + "version": "2" + }' > manifest.json } reload_terms() { |