Add global dark/light theme switch with key bind

This commit is contained in:
coolneng 2020-10-12 19:45:16 +02:00
parent ac74cedb5f
commit a7764f6878
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
10 changed files with 142 additions and 78 deletions

View File

@ -0,0 +1,39 @@
background #161821
foreground #c6c8d1
selection_background #1e2132
selection_foreground #c6c8d1
cursor #d2d4de
# black
color0 #161821
color8 #6b7089
# red
color1 #e27878
color9 #e98989
# green
color2 #b4be82
color10 #c0ca8e
# yellow/orange
color3 #e2a478
color11 #e9b189
# blue
color4 #84a0c6
color12 #91acd1
# magenta/purple
color5 #a093c7
color13 #ada0d3
# cyan
color6 #89b8c2
color14 #95c4ce
# white
color7 #c6c8d1
color15 #d2d4de

View File

@ -0,0 +1,40 @@
background #e8e9ec
foreground #33374c
selection_background #d2d4dd
selection_foreground #33374c
cursor #33374c
cursor_text_color #e8e9ec
# black
color0 #dcdfe7
color8 #8389a3
# red
color1 #cc517a
color9 #cc3768
# green
color2 #668e3d
color10 #598030
# yellow/orange
color3 #c57339
color11 #b6662d
# blue
color4 #2d539e
color12 #22478e
# magenta/purple
color5 #7759b4
color13 #6845ad
# cyan
color6 #3f83a6
color14 #327698
# white
color7 #33374c
color15 #262a3f

View File

@ -459,8 +459,7 @@ inactive_tab_font_style normal
#: Color scheme {{{ #: Color scheme {{{
foreground #c6c8d1 include iceberg_dark.conf
background #161821
#: The foreground and background colors #: The foreground and background colors
@ -490,62 +489,6 @@ dynamic_background_opacity no
dim_opacity 0.75 dim_opacity 0.75
#: How much to dim text that has the DIM/FAINT attribute set. One
#: means no dimming and zero means fully dimmed (i.e. invisible).
selection_foreground #000000
#: The foreground for text selected with the mouse. A value of none
#: means to leave the color unchanged.
selection_background #fffacd
#: The background for text selected with the mouse.
#: The 16 terminal colors. There are 8 basic colors, each color has a
#: dull and bright version. You can also set the remaining colors from
#: the 256 color table as color16 to color255.
color0 #161821
color8 #6b7089
#: black
color1 #e27878
color9 #e98989
#: red
color2 #b4be82
color10 #c0ca8e
#: green
color3 #e2a478
color11 #e9b189
#: yellow
color4 #84a0c6
color12 #91acd1
#: blue
color5 #a093c7
color13 #ada0d3
#: magenta
color6 #89b8c2
color14 #95c4ce
#: cyan
color7 #c6c8d1
color15 #d2d4de
#: white
#: }}} #: }}}

View File

@ -40,6 +40,7 @@ Plug 'cocopon/iceberg.vim'
call plug#end() call plug#end()
""Colors ""Colors
colorscheme iceberg colorscheme iceberg
set bg=dark
set termguicolors set termguicolors
""Sets the colorscheme in tmux ""Sets the colorscheme in tmux
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"

View File

@ -0,0 +1,27 @@
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: switch_theme <mode>"
echo "mode: dark|light"
exit 1
fi
mode=$1
if [ "$mode" = "light" ]; then
emacsclient --eval "(load-theme 'doom-nord-light)"
sed -i "s/iceberg_dark/iceberg_light/" ~/.config/kitty/kitty.conf
sed -i "s/bg=dark/bg=light/" ~/.config/nvim/init.vim
sed -i "s/iceberg_dark/iceberg_light/" ~/.dotfiles/tmux/.tmux.conf
pkill kitty
tmux source-file ~/.tmux.conf
kitty --class tmux tmux a
else
emacsclient --eval "(load-theme 'doom-nord)"
sed -i "s/iceberg_light/iceberg_dark/" ~/.config/kitty/kitty.conf
sed -i "s/bg=light/bg=dark/" ~/.config/nvim/init.vim
sed -i "s/iceberg_light/iceberg_dark/" ~/.dotfiles/tmux/.tmux.conf
pkill kitty
tmux source-file ~/.tmux.conf
kitty --class tmux tmux a
fi

View File

@ -293,6 +293,19 @@ mode "$Pause-break" {
bindsym Escape mode "default" bindsym Escape mode "default"
} }
# theme switcher menu
bindsym $mod+Shift+t mode "$Theme-switch"
set $Theme-switch (l) light-theme, (d) dark-theme
mode "$Theme-switch" {
bindsym l exec --no-startup-id ~/.local/share/scripts/switch_theme "light", mode "default"
bindsym d exec --no-startup-id ~/.local/share/scripts/switch_theme "dark", mode "default"
bindsym Return mode "default"
bindsym Escape mode "default"
}
# lock screen on suspend # lock screen on suspend
set $lock_bg ~/Photos/Wallpapers/wallhaven-638719.png set $lock_bg ~/Photos/Wallpapers/wallhaven-638719.png
exec swayidle -w \ exec swayidle -w \

View File

@ -74,4 +74,4 @@ bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "se
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M" bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
# Colorscheme file # Colorscheme file
source-file ~/.tmux/iceberg.tmux.conf source-file ~/.tmux/iceberg_dark.tmux.conf

View File

@ -1,19 +0,0 @@
# vim: ft=tmux
set -g status-justify "centre"
set -g status "on"
set -g status-left-style "none"
set -g message-command-style "fg=#c6c8d1,bg=#2e3244"
set -g status-right-style "none"
set -g pane-active-border-style "fg=#454b68"
set -g status-style "none,bg=#1e2132"
set -g message-style "fg=#c6c8d1,bg=#2e3244"
set -g pane-border-style "fg=#2e3244"
set -g status-right-length "100"
set -g status-left-length "100"
setw -g window-status-activity-style "none,fg=#454b68,bg=#1e2132"
setw -g window-status-separator ""
setw -g window-status-style "none,fg=#c6c8d1,bg=#1e2132"
set -g status-left "#[fg=#c6c8d1,bg=#454b68,bold] #S #[fg=#454b68,bg=#2e3244,nobold,nounderscore,noitalics]#[fg=#c6c8d1,bg=#1e2132] #[fg=#1e2132,bg=#1e2132,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#1e2132,bg=#1e2132,nobold,nounderscore,noitalics]#[fg=#c6c8d1,bg=#1e2132] #[fg=#2e3244,bg=#1e2132,nobold,nounderscore,noitalics]#[fg=#c6c8d1,bg=#2e3244] %b %d %Y #[fg=#454b68,bg=#2e3244,nobold,nounderscore,noitalics]#[fg=#c6c8d1,bg=#454b68,bold] %R #{prefix_highlight} "
setw -g window-status-format "#[fg=#1e2132,bg=#1e2132,nobold,nounderscore,noitalics] #[fg=#c6c8d1] #I  #W #[fg=#1e2132,bg=#1e2132,nobold,nounderscore,noitalics]"
setw -g window-status-current-format "#[fg=#1e2132,bg=#2e3244,nobold,nounderscore,noitalics]#[fg=#c6c8d1,bg=#2e3244] #I  #W #[fg=#2e3244,bg=#1e2132,nobold,nounderscore,noitalics]"

View File

@ -0,0 +1,10 @@
set -g status-justify "centre"
set -g status "on"
set -g status-left-style "none"
set -g status-style "none,bg=#1e2132"
set -g status-left "#[bold] #S"
set -g pane-border-style "fg=#2e3244"
set -g pane-active-border-style "fg=#454b68"
setw -g window-status-style "none,fg=#c6c8d1,bg=#1e2132"
setw -g window-status-format " #[fg=#c6c8d1] #I - #W "
setw -g window-status-current-format " #[fg=#c6c8d1,bg=#2e3244,bold] #I - #W "

View File

@ -0,0 +1,10 @@
set -g status-justify "centre"
set -g status "on"
set -g status-left-style "none"
set -g status-style "none,bg=#d2d4dd"
set -g status-left "#[bold] #S"
set -g pane-border-style "fg=#c6c8d1"
set -g pane-active-border-style "fg=#33374c"
setw -g window-status-style "none,fg=#33374c,bg=#d2d4dd"
setw -g window-status-format " #[fg=#afafaf] #I - #W "
setw -g window-status-current-format " #[fg=#282a2e,bold] #I - #W "