diff options
Diffstat (limited to '.local/share/mode')
-rw-r--r-- | .local/share/mode/plug.d/10_lib | 31 | ||||
-rw-r--r-- | .local/share/mode/plug.d/20_export_colors | 2 | ||||
-rw-r--r-- | .local/share/mode/plug.d/20_export_mode | 2 | ||||
-rw-r--r-- | .local/share/mode/plug.d/20_export_vim_theme | 2 | ||||
-rw-r--r-- | .local/share/mode/plug.d/50_accent | 17 | ||||
-rwxr-xr-x | .local/share/mode/switch.d/chromium | 9 | ||||
-rwxr-xr-x | .local/share/mode/switch.d/discord | 3 | ||||
-rwxr-xr-x | .local/share/mode/switch.d/dunst | 3 | ||||
-rwxr-xr-x | .local/share/mode/switch.d/fcitx5 | 2 | ||||
-rwxr-xr-x | .local/share/mode/switch.d/mode | 10 | ||||
-rwxr-xr-x | .local/share/mode/switch.d/polybar | 3 | ||||
-rwxr-xr-x | .local/share/mode/switch.d/rofi | 8 | ||||
-rwxr-xr-x | .local/share/mode/switch.d/vim | 9 | ||||
-rwxr-xr-x | .local/share/mode/switch.d/zathura | 3 | ||||
-rw-r--r-- | .local/share/mode/themes/github-black | 25 | ||||
-rw-r--r-- | .local/share/mode/themes/xcode-dark | 24 |
16 files changed, 113 insertions, 40 deletions
diff --git a/.local/share/mode/plug.d/10_lib b/.local/share/mode/plug.d/10_lib index 61817bc..abe75b1 100644 --- a/.local/share/mode/plug.d/10_lib +++ b/.local/share/mode/plug.d/10_lib @@ -1,5 +1,36 @@ #!/bin/sh # utility library functions hex_to_rgb_array() { pastel format rgb "$1" | cut -c4- | tr '()' '[]' ; } + mix_rgb() { pastel mix --colorspace=RGB --fraction="$3" "$1" "$2" | pastel format hex ; } +getvar() { + key="$1" + eval "printf '%s' \"\$$key\"" +} + +setvar() { + key="$1" + value="$2" + eval "$key='$(printf '%s' "$value")'" +} + +themevar() { + key="$1" + if [ $# -eq 1 ] ; then + value="$(getvar "$key")" + else + value="$2" + setvar "$key" "$value" + fi + + vars="$vars +$(printf "export %s='%s'" "$key" "$value")" + eval "export $key" +} + +mkcd() { + mkdir -p "$1" + cd "$1" +} + diff --git a/.local/share/mode/plug.d/20_export_colors b/.local/share/mode/plug.d/20_export_colors index 017446d..0f53d1f 100644 --- a/.local/share/mode/plug.d/20_export_colors +++ b/.local/share/mode/plug.d/20_export_colors @@ -9,7 +9,7 @@ check_color() { echo "error: color $1 is not properly formatted (#RRGGBB)" stupid && exit 1 fi - eval "export $1" + themevar "$1" } for color in $(seq 0 15 | sed 's/^/color/') bg fg ; do check_color $color diff --git a/.local/share/mode/plug.d/20_export_mode b/.local/share/mode/plug.d/20_export_mode index 78432b6..c82c4e1 100644 --- a/.local/share/mode/plug.d/20_export_mode +++ b/.local/share/mode/plug.d/20_export_mode @@ -5,5 +5,5 @@ if [ "$mode" != 'dark' ] && [ "$mode" != 'light' ] ; then [ $? -eq 0 ] && mode=dark || mode=light echo "warn: theme $theme did not define \$mode as \"light\" or \"dark\", guessed $mode" >&2 fi -export mode +themevar mode diff --git a/.local/share/mode/plug.d/20_export_vim_theme b/.local/share/mode/plug.d/20_export_vim_theme index be76b8b..12304f3 100644 --- a/.local/share/mode/plug.d/20_export_vim_theme +++ b/.local/share/mode/plug.d/20_export_vim_theme @@ -3,4 +3,4 @@ if [ "$(find "$XDG_CONFIG_HOME/nvim" -name "$vim_theme_name.vim" | wc -l)" -eq 0 ] ; then echo "warn: vim theme $vim_theme_name does not appear to be installed" >&2 fi -export vim_theme_name +themevar vim_theme_name diff --git a/.local/share/mode/plug.d/50_accent b/.local/share/mode/plug.d/50_accent index 2a8a113..ceb3209 100644 --- a/.local/share/mode/plug.d/50_accent +++ b/.local/share/mode/plug.d/50_accent @@ -4,13 +4,12 @@ # do not generate accent color if already explicitly defined by theme [ -n "$accent" ] && return -[ "$mode" = "light" ] && { - accent="$color15" - accent_text="$color0" -} -[ "$mode" = "dark" ] && { - accent="$(mix_rgb $bg $color0 0.5)" - accent_text="$fg" -} +if [ "$mode" = "light" ] ; then + themevar accent "$color15" + themevar accent_text "$color0" +fi +if [ "$mode" = "dark" ] ; then + themevar accent "$(mix_rgb $bg $color0 0.5)" + themevar accent_text "$fg" +fi -export accent accent_text diff --git a/.local/share/mode/switch.d/chromium b/.local/share/mode/switch.d/chromium index 9048b80..fb701a5 100755 --- a/.local/share/mode/switch.d/chromium +++ b/.local/share/mode/switch.d/chromium @@ -1,17 +1,16 @@ #!/bin/sh -PREFIX="$XDG_CACHE_HOME/mode/chromium" +mkcd "$XDG_CACHE_HOME/mode/chromium" -mkdir -p "$PREFIX" -rm -f "$PREFIX/Cached Theme.pak" +rm -f 'Cached Theme.pak' -magick -size 100x100 "xc:$bg" "$PREFIX/bg.png" +magick -size 100x100 "xc:$bg" 'bg.png' bg_alt=$(mix_rgb $color7 $bg 0.20) fg_alt=$(mix_rgb $color15 $fg 0.60) bg="$(hex_to_rgb_array "$bg")" fg="$(hex_to_rgb_array "$fg")" bg_alt="$(hex_to_rgb_array "$bg_alt")" fg_alt="$(hex_to_rgb_array "$fg_alt")" -cat << EOF > "$PREFIX/manifest.json" +cat << EOF > 'manifest.json' { "description": "colorscheme generated by mode", "manifest_version": 2, diff --git a/.local/share/mode/switch.d/discord b/.local/share/mode/switch.d/discord index f656783..5931dec 100755 --- a/.local/share/mode/switch.d/discord +++ b/.local/share/mode/switch.d/discord @@ -1,5 +1,6 @@ #!/bin/sh -cat << EOF > "$XDG_CONFIG_HOME/BetterDiscord/themes/mode.theme.css" +mkcd "$XDG_CONFIG_HOME/BetterDiscord/themes" +cat << EOF > 'mode.theme.css' /** * @name mode * @author mode diff --git a/.local/share/mode/switch.d/dunst b/.local/share/mode/switch.d/dunst index d4fd8dc..f863100 100755 --- a/.local/share/mode/switch.d/dunst +++ b/.local/share/mode/switch.d/dunst @@ -1,5 +1,6 @@ #!/bin/sh -cat "$XDG_CONFIG_HOME/dunst/base" - << EOF > "$XDG_CONFIG_HOME/dunst/dunstrc" +mkcd "$XDG_CONFIG_HOME/dunst" +cat 'base' - << EOF > 'dunstrc' frame_color = "$accent" [urgency_low] diff --git a/.local/share/mode/switch.d/fcitx5 b/.local/share/mode/switch.d/fcitx5 index 4b35478..71880a7 100755 --- a/.local/share/mode/switch.d/fcitx5 +++ b/.local/share/mode/switch.d/fcitx5 @@ -1,5 +1,5 @@ #!/bin/sh -cd "$XDG_DATA_HOME/fcitx5/themes/default" +mkcd "$XDG_DATA_HOME/fcitx5/themes/default" rounding=6 size=$(( 2 * $rounding + 4 )) margin_h=6 diff --git a/.local/share/mode/switch.d/mode b/.local/share/mode/switch.d/mode index 3b58fa6..f4c916e 100755 --- a/.local/share/mode/switch.d/mode +++ b/.local/share/mode/switch.d/mode @@ -1,8 +1,8 @@ #!/bin/sh -PREFIX="$XDG_CACHE_HOME/mode/state" -rm -rf "$PREFIX"/* -mkdir -p "$PREFIX" +mkcd "$XDG_CACHE_HOME/mode/state" -echo "$mode" > "$PREFIX/mode" -ln -sf "$theme" "$PREFIX/theme" +echo "$mode" > mode +rm theme +ln -sf "$theme" theme +echo "#!/bin/sh$vars" > vars diff --git a/.local/share/mode/switch.d/polybar b/.local/share/mode/switch.d/polybar index b7e752a..17fcee2 100755 --- a/.local/share/mode/switch.d/polybar +++ b/.local/share/mode/switch.d/polybar @@ -1,5 +1,6 @@ #!/bin/sh -cat << EOF > "$XDG_CONFIG_HOME/polybar/colors.ini" +mkcd "$XDG_CONFIG_HOME/polybar" +cat << EOF > 'colors.ini' [color] bg = \${xrdb:background:$bg} fg = \${xrdb:foreground:$fg} diff --git a/.local/share/mode/switch.d/rofi b/.local/share/mode/switch.d/rofi deleted file mode 100755 index 19b9008..0000000 --- a/.local/share/mode/switch.d/rofi +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -cat << EOF > "$XDG_CONFIG_HOME/rofi/colors" -export background="$bg" -export foreground="$fg" -export accent="$accent" -export accent_text="$accent_text" -EOF - diff --git a/.local/share/mode/switch.d/vim b/.local/share/mode/switch.d/vim index 6c83f9f..7c2bbf6 100755 --- a/.local/share/mode/switch.d/vim +++ b/.local/share/mode/switch.d/vim @@ -1,9 +1,8 @@ #!/bin/sh -PREFIX="$XDG_CONFIG_HOME/nvim/mode" -mkdir -p "$PREFIX" +mkcd "$XDG_CONFIG_HOME/nvim/mode" # lightline -cat << EOF > "$PREFIX/lightline.vim" +cat << EOF > 'lightline.vim' let s:bg = [ '$bg', 'NONE' ] let s:fg = [ '$fg', 'NONE' ] let s:mode = [ '$color0', 'NONE' ] @@ -32,7 +31,7 @@ let g:lightline#colorscheme#auto#palette = lightline#colorscheme#flatten(s:p) EOF # terminal colors -cat << EOF > "$PREFIX/termcolors.vim" +cat << EOF > 'termcolors.vim' let g:terminal_color_0 = '$color0' let g:terminal_color_1 = '$color1' let g:terminal_color_2 = '$color2' @@ -52,7 +51,7 @@ let g:terminal_color_15 = '$color15' EOF # color scheme -cat << EOF > "$PREFIX/colorscheme.vim" +cat << EOF > 'colorscheme.vim' colorscheme $vim_theme_name EOF diff --git a/.local/share/mode/switch.d/zathura b/.local/share/mode/switch.d/zathura index c0687df..e1a15e7 100755 --- a/.local/share/mode/switch.d/zathura +++ b/.local/share/mode/switch.d/zathura @@ -1,5 +1,6 @@ #!/bin/sh -cat << EOF > "$XDG_CONFIG_HOME/zathura/colors" +mkcd "$XDG_CONFIG_HOME/zathura" +cat << EOF > 'colors' set completion-bg "$bg" set completion-fg "$fg" set completion-highlight-bg "$accent" diff --git a/.local/share/mode/themes/github-black b/.local/share/mode/themes/github-black new file mode 100644 index 0000000..34b507c --- /dev/null +++ b/.local/share/mode/themes/github-black @@ -0,0 +1,25 @@ +#!/bin/sh +mode=dark + +color0='#484f58' +color1='#ffa198' +color2='#56d364' +color3='#e3b341' +color4='#79c0ff' +color5='#d2a8ff' +color6='#56d4dd' +color7='#b1bac4' +color8='#6e7681' +color9='#ff7b72' +color10='#3fb950' +color11='#d29922' +color12='#58a6ff' +color13='#bc8cff' +color14='#39c5cf' +color15='#ffffff' + +bg='#000000' +fg='#e6edf3' + +vim_theme_name='ghdark' + diff --git a/.local/share/mode/themes/xcode-dark b/.local/share/mode/themes/xcode-dark new file mode 100644 index 0000000..eb75b80 --- /dev/null +++ b/.local/share/mode/themes/xcode-dark @@ -0,0 +1,24 @@ +#!/bin/sh +mode=dark + +color0='#43454b' +color1='#ff8a7a' +color2='#83c9bc' +color3='#d9c668' +color4='#4ec4e6' +color5='#ff85b8' +color6='#cda1ff' +color7='#ffffff' +color8='#838991' +color9='#ff8a7a' +color10='#b1faeb' +color11='#ffa14f' +color12='#6bdfff' +color13='#ff85b8' +color14='#e5cfff' +color15='#ffffff' + +bg='#1f1f24' +fg='#e6edf3' + +vim_theme_name='xcodedarkhc' |