From d9196304cae3c4b901e1fb7e2d966c6cefb525c3 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 7 Mar 2025 17:43:15 +1100 Subject: scheme: use material colours for layers & accents --- scheme/gen-scheme.fish | 48 ++++++------------------------------------------ 1 file changed, 6 insertions(+), 42 deletions(-) (limited to 'scheme/gen-scheme.fish') diff --git a/scheme/gen-scheme.fish b/scheme/gen-scheme.fish index 4f2cf04..ae807cb 100755 --- a/scheme/gen-scheme.fish +++ b/scheme/gen-scheme.fish @@ -1,52 +1,16 @@ #!/bin/fish -function nl-echo - # Echo with newlines - for a in $argv - echo $a - end -end - -function light-theme - set -g light_vals 50,10,16,22,34,46,59,69,78,85,97,94,90 - set -g colour_scheme light -end - -function dark-theme - set -g light_vals 70,90,75,63,52,42,32,26,20,16,12,9,6 - set -g colour_scheme dark -end - set -l src (dirname (status filename)) . $src/../util.fish -if test "$argv[1]" = --theme - set theme $argv[2] - set -e argv[1..2] -end - test -f "$argv[1]" && set -l img "$argv[1]" || set -l img $C_STATE/wallpaper/current set -l img (realpath $img) +contains -- "$argv[2]" light dark && set -l theme $argv[2] || set -l theme dark -if set -q theme - test "$theme" = light && light-theme || dark-theme -else - # Light theme if background lighter than foreground - set -l bg_fg ($src/getlightness.py (okolors $img -k 2 | string split ' ')) - test "$bg_fg[1]" -gt "$bg_fg[2]" && light-theme || dark-theme -end - -echo -n $colour_scheme > $C_STATE/scheme/dynamic-mode.txt - -# 2nd line except first element is the palette -# The first element in lines 3+ are the layers -set -l names rosewater flamingo pink mauve red maroon peach yellow green teal sky sapphire blue lavender text subtext1 subtext0 overlay2 overlay1 overlay0 surface2 surface1 surface0 base mantle crust success error -set -l colours ($src/autoadjust.py $colour_scheme (okolors $img -k 15 -w 0 -l $light_vals)) - -for i in (seq 1 (count $colours)) - echo "$names[$i] $colours[$i]" -end +# Generate colours +test $theme = light && set -l lightness 50 || set -l lightness 70 +$src/autoadjust.py $theme (okolors $img -k 14 -w 0 -l $lightness) -set -l accent (okolors $img -k 4 | cut -d ' ' -f 4) -echo -n "accent $accent" +# Generate layers and accents +$src/genmaterial.py $img $theme | head -c -1 # Trim trailing newline -- cgit v1.2.3-freya