add dark-blue theme

This commit is contained in:
Łukasz Pankowski 2020-07-21 21:34:44 +02:00
parent 1cefb235de
commit 60814159c2
5 changed files with 88 additions and 41 deletions

View File

@ -4,7 +4,7 @@ env:
TERM: xterm-256color TERM: xterm-256color
schemas: schemas:
lupan_light: &dark lupan_dark: &dark
primary: primary:
background: '#1a3a34' background: '#1a3a34'
foreground: '#f2f6e1' foreground: '#f2f6e1'
@ -26,6 +26,28 @@ schemas:
magenta: '#b056b5' magenta: '#b056b5'
cyan: '#169191' cyan: '#169191'
white: '#ffffff' white: '#ffffff'
lupan_dark_blue: &dark-blue
primary:
background: '#092e50'
foreground: '#c0c0c0'
normal:
black: '#000000'
red: '#e6436d'
green: '#59c19f'
yellow: '#f6bc25'
blue: '#55b3fd'
magenta: '#dc88e9'
cyan: '#77adc4'
white: '#f2f6e1'
bright:
black: '#888888'
red: '#e694a9'
green: '#94e6a9'
yellow: '#fbda62'
blue: '#1081ff'
magenta: '#b056b5'
cyan: '#169191'
white: '#ffffff'
lupan_light: &light lupan_light: &light
primary: primary:
background: '#f2f6e1' background: '#f2f6e1'
@ -59,4 +81,4 @@ font:
key_bindings: key_bindings:
- key: F6 - key: F6
mods: Control|Shift mods: Control|Shift
command: { program: "/bin/sh", args: ["-c", "~/.config/alacritty/switch_bg.py"] } command: { program: "/bin/sh", args: ["-c", "~/.config/alacritty/set_theme.sh next"] }

View File

@ -0,0 +1,21 @@
#!/bin/sh
case "$1" in
dark|dark-blue|light)
sed -i "s/^colors: [*].*/colors: *$1/" ~/.config/alacritty/alacritty.yml
;;
next)
case $(grep colors: ~/.config/alacritty/alacritty.yml) in
'colors: *dark')
THEME=dark-blue
;;
'colors: *dark-blue')
THEME=light
;;
*)
THEME=dark
;;
esac
sed -i "s/^colors: [*].*/colors: *$THEME/" ~/.config/alacritty/alacritty.yml
;;
esac

View File

@ -1,17 +0,0 @@
#!/usr/bin/python3
import os
import sys
action = 'switch'
if len(sys.argv) > 1:
action = sys.argv[1]
path = os.path.join(os.getenv('HOME'), '.config/alacritty/alacritty.yml')
with open(path, 'r+') as f:
cfg = f.read()
if "colors: *dark" in cfg and action in ['switch', 'light']:
cfg = cfg.replace("colors: *dark", "colors: *light")
elif "colors: *light" in cfg and action in ['switch', 'dark']:
cfg = cfg.replace("colors: *light", "colors: *dark")
f.seek(0)
f.write(cfg)

View File

@ -3,29 +3,40 @@
CMD="$1" CMD="$1"
shift shift
is_light() { if [ "$CMD" = theme ]; then
bspc config focused_border_color | grep '#068c70' > /dev/null THEME="$1"
} if [ "$THEME" = next ]; then
case $(bspc config focused_border_color) in
if [ "$CMD" = switch-colors ]; then '#23aba4')
if is_light; then THEME=dark-blue
CMD=dark-colors ;;
SCHEME=dark '#3585ce')
else THEME=light
CMD=light-colors ;;
SCHEME=light *)
THEME=dark
;;
esac
fi fi
elif is_light; then
SCHEME=light
else else
SCHEME=dark case $(bspc config focused_border_color) in
'#068c70')
THEME=light
;;
'#3585ce')
THEME=dark-blue
;;
*)
THEME=dark
;;
esac
fi fi
FONT=Iosevka:pixelsize=30 FONT=Iosevka:pixelsize=30
BAR_FONT='Iosevka:pixelsize=23:antialias=true:autohint=true;5' BAR_FONT='Iosevka:pixelsize=23:antialias=true:autohint=true;5'
BAR_HEIGHT=40 BAR_HEIGHT=40
if [ "$SCHEME" = light ]; then if [ "$THEME" = light ]; then
ROOT_BG=#c1e6c2 ROOT_BG=#c1e6c2
BAR_BG=#e1e6d2 BAR_BG=#e1e6d2
BAR_FG=#1a343a BAR_FG=#1a343a
@ -35,7 +46,7 @@ if [ "$SCHEME" = light ]; then
NORMAL_BORDER=#b0b0b0 NORMAL_BORDER=#b0b0b0
FOCUS_BORDER=#068c70 FOCUS_BORDER=#068c70
EMACS_THEME=lupan-light EMACS_THEME=lupan-light
else elif [ "$THEME" = dark-blue ]; then
ROOT_BG=#404040 ROOT_BG=#404040
BAR_BG=#1a343a BAR_BG=#1a343a
BAR_FG=#f2f6e1 BAR_FG=#f2f6e1
@ -44,11 +55,21 @@ else
BAR_EMPTY=#808080 BAR_EMPTY=#808080
NORMAL_BORDER=#808080 NORMAL_BORDER=#808080
FOCUS_BORDER=#3585ce FOCUS_BORDER=#3585ce
EMACS_THEME=lupan-dark-blue
else
ROOT_BG=#404040
BAR_BG=#1a343a
BAR_FG=#f2f6e1
BAR_ACTIVE=#23aba4
BAR_URGENT=#9b0640
BAR_EMPTY=#808080
NORMAL_BORDER=#808080
FOCUS_BORDER=#23aba4
EMACS_THEME=lupan-dark EMACS_THEME=lupan-dark
fi fi
DMENU_ARGS="-nb ${BAR_BG} -nf ${BAR_FG} -sb ${BAR_ACTIVE} -sf ${BAR_FG} -fn $FONT" DMENU_ARGS="-nb ${BAR_BG} -nf ${BAR_FG} -sb ${BAR_ACTIVE} -sf ${BAR_FG} -fn $FONT"
switch_colors() { set_theme() {
xrdb -merge <<EOF xrdb -merge <<EOF
polybar.background: ${BAR_BG} polybar.background: ${BAR_BG}
polybar.foreground: ${BAR_FG} polybar.foreground: ${BAR_FG}
@ -63,13 +84,13 @@ EOF
bspc config normal_border_color "${NORMAL_BORDER}" bspc config normal_border_color "${NORMAL_BORDER}"
bspc config focused_border_color "${FOCUS_BORDER}" bspc config focused_border_color "${FOCUS_BORDER}"
bspc config presel_feedback_color "${FOCUS_BORDER}" bspc config presel_feedback_color "${FOCUS_BORDER}"
python ~/.config/alacritty/switch_bg.py "$SCHEME" sed -i "s/^colors: [*].*/colors: *$THEME/" ~/.config/alacritty/alacritty.yml
emacsclient --eval "(my-select-theme '${EMACS_THEME})" emacsclient --eval "(my-select-theme '${EMACS_THEME})"
} }
case "$CMD" in case "$CMD" in
light-colors|dark-colors) theme)
switch_colors set_theme
;; ;;
dmenu|dmenu_run) dmenu|dmenu_run)
exec "$CMD" ${DMENU_ARGS} "$@" exec "$CMD" ${DMENU_ARGS} "$@"

View File

@ -24,7 +24,7 @@ super + semicolon ; shift + {h,l,s}
{systemctl hibernate,slock,systemctl suspend} {systemctl hibernate,slock,systemctl suspend}
super + F6 super + F6
sh ~/.config/bspwm/commands.sh switch-colors sh ~/.config/bspwm/commands.sh theme next
XF86AudioPlay XF86AudioPlay
mpc toggle mpc toggle