feat(desktop): color rework

This commit is contained in:
Pavel Korytov 2023-07-31 17:39:35 +03:00
parent bb07661e21
commit 1d8da7a2bb
6 changed files with 116 additions and 78 deletions

View file

@ -51,7 +51,7 @@
frame_width = 1
# Defines color of the frame around the notification window.
frame_color = "#d0d0d0"
frame_color = "#A6Accd"
# Define a color for the separator.
# possible values are:
@ -262,24 +262,24 @@
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#434758"
frame_color = "#d0d0d0"
foreground = "#ffffff"
background = "#313441"
frame_color = "#A6Accd"
foreground = "#c1c7e9"
timeout = 10
# Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon
[urgency_normal]
background = "#292d3e"
frame_color = "#d0d0d0"
foreground = "#ffffff"
background = "#1c1f2b"
frame_color = "#A6Accd"
foreground = "#c1c7e9"
timeout = 10
# Icon for notifications with normal urgency, uncomment to enable
#icon = /path/to/icon
[urgency_critical]
background = "#f07178"
foreground = "#ffffff"
foreground = "#c1c7e9"
frame_color = "#f07178"
timeout = 0
# Icon for notifications with critical urgency, uncomment to enable

View file

@ -18,7 +18,7 @@ light-cyan = ${xrdb:color14}
light-white = ${xrdb:color15}
background = ${xrdb:background}
; foreground = ${xrdb:foreground}
foreground = ${xrdb:color0}
; Colors:2 ends here
; [[file:../../Desktop.org::*Glyph settings][Glyph settings:1]]
@ -251,6 +251,8 @@ label-muted = MUTE
format-volume-background = ${colors.light-magenta}
format-muted-background = ${colors.light-magenta}
format-volume-foreground = ${colors.foreground}
format-muted-foreground = ${colors.foreground}
; format-volume-underline = ${colors.white}
; format-muted-underline = ${colors.light-black}
@ -276,6 +278,9 @@ label-song-ellipsis = true
format-playing-background = ${colors.magenta}
format-paused-background = ${colors.magenta}
format-stopped-background = ${colors.magenta}
format-playing-foreground = ${colors.foreground}
format-paused-foreground = ${colors.foreground}
format-stopped-foreground = ${colors.foreground}
label-separator = 0
separator-foreground = ${colors.red}
@ -293,6 +298,7 @@ type = internal/cpu
format = " <label>"
label = %percentage%%
format-background = ${colors.cyan}
format-foreground = ${colors.foreground}
; cpu:1 ends here
; [[file:../../Desktop.org::*ram-memory][ram-memory:1]]
@ -314,6 +320,7 @@ label=%gb_used:.1f%
; format-underline = ${colors.blue}
format-background = ${colors.light-green}
format-foreground = ${colors.foreground}
; ram-memory:1 ends here
; [[file:../../Desktop.org::*swap-memory][swap-memory:1]]
@ -323,6 +330,7 @@ interval = 10
label= %gb_swap_used:.1f%
format-background = ${colors.green}
format-foreground = ${colors.foreground}
; swap-memory:1 ends here
; [[file:../../Desktop.org::*network][network:1]]
@ -341,6 +349,8 @@ label-disconnected = X
; format-disconnected-underline = ${colors.red}
format-connected-background = ${colors.nil}
format-disconnected-background = ${colors.nil}
format-connected-foreground = ${colors.foreground}
format-disconnected-foreground = ${colors.foreground}
ramp-signal-0 = 0
ramp-signal-1 = 1
@ -358,6 +368,7 @@ interval = 0
tail = true
format-background = ${colors.light-red}
format-foreground = ${colors.foreground}
; bandwidth:1 ends here
; [[file:../../Desktop.org::*ipstack-vpn][ipstack-vpn:2]]
@ -372,6 +383,7 @@ interval = 1200
type = custom/script
exec = /home/pavel/bin/polybar/openvpn.sh
format-background = ${colors.light-red}
format-foreground = ${colors.foreground}
interval = 1200
; openvpn:2 ends here
@ -382,6 +394,7 @@ format = <label-layout>
; format-underline = ${colors.magenta}
format-background = ${colors.red}
format-foreground = ${colors.foreground}
label-layout = %icon%
layout-icon-0 = ru;RU
layout-icon-1 = us;US
@ -398,6 +411,7 @@ format-discharging = <ramp-capacity> <label-discharging>
format-discharging-background = ${colors.light-cyan}
format-charging-background = ${colors.light-cyan}
format-full-background = ${colors.light-cyan}
format-foreground = ${colors.foreground}
label-discharging = %percentage%% %time%
label-charging =  %percentage%% %time%
@ -414,6 +428,7 @@ type = custom/script
exec = /home/pavel/bin/polybar/weather.sh
; format-underline = ${colors.red}
format-background = ${colors.light-yellow}
format-foreground = ${colors.foreground}
interval = 1200
; weather:2 ends here
@ -422,6 +437,7 @@ interval = 1200
type = custom/script
exec = /home/pavel/bin/polybar/sun.sh
format-background = ${colors.yellow}
format-foreground = ${colors.foreground}
interval = 60
; sun:2 ends here
@ -431,6 +447,7 @@ type = custom/script
exec = /home/pavel/bin/polybar/aw_afk.sh
interval = 60
format-background = ${colors.light-blue}
format-foreground = ${colors.foreground}
; aw-afk:2 ends here
; [[file:../../Desktop.org::*date][date:1]]
@ -445,6 +462,7 @@ time = %H:%M
time-alt = %H:%M:%S
format-background = ${colors.blue}
format-foreground = ${colors.foreground}
label = "%date% %time%"
; date:1 ends here
@ -454,6 +472,7 @@ type = custom/script
exec = /home/pavel/bin/polybar/pomm.sh
interval = 1
format-underline = ${colors.light-green}
format-foreground = ${colors.foreground}
; pomm:2 ends here
; [[file:../../Desktop.org::*SEP][SEP:1]]

View file

@ -1,22 +1,21 @@
/* Generated from [[file:../../Desktop.org::*Theme][Theme:1]] */
* {
black: #292d3e;
black: #1c1f2b;
red: #f07178;
green: #c3e88d;
yellow: #ffcb6b;
blue: #82aaff;
magenta: #c792ea;
cyan: #89ddff;
white: #d0d0d0;
light-black: #434758;
light-red: #ff8b92;
light-green: #ddffa7;
light-yellow: #ffe585;
light-blue: #9cc4ff;
light-magenta: #e1acff;
light-cyan: #a3f7ff;
light-white: #ffffff;
color-fg: #000000;
cyan: #89DDFF;
white: #A6Accd;
light-black: #313441;
light-red: #ff8c91;
light-green: #dfffa7;
light-yellow: #ffe785;
light-blue: #9fc5ff;
light-magenta: #e3acff;
light-cyan: #a6f9ff;
light-white: #c1c7e9;
foreground: @white;

View file

@ -6,22 +6,24 @@ set recolor true
map <C-r> set recolor false
map <C-R> set recolor true
set recolor-lightcolor "#292d3e"
set recolor-lightcolor "#292D3E"
set completion-bg "#292d3e"
set completion-fg "#d0d0d0"
set completion-group-bg "#434758"
set completion-group-fg "#d0d0d0"
set completion-bg "#292D3E"
set completion-fg "#A6Accd"
set completion-group-bg "#292D3E"
set completion-group-fg "#A6Accd"
set completion-highlight-bg "#c792ea"
set completion-highlight-fg "#292d3e"
set completion-highlight-fg "#1c1f2b"
set inputbar-bg "#292d3e"
set inputbar-fg "#e1acff"
set statusbar-bg "#292d3e"
set statusbar-fg "#e1acff"
set inputbar-bg "#292D3E"
set inputbar-fg "#e3acff"
set statusbar-bg "#292D3E"
set statusbar-fg "#e3acff"
set notification-error-bg "#f07178"
# set notification-error-fg ""
set notification-error-fg "#000000"
set notification-warning-bg "#ffcb6b"
# set notification-warning-fg ""
set notification-warning-fg "#000000"
# Zathura:1 ends here

View file

@ -26,9 +26,9 @@
:straight (:host github :repo "SqrtMinusOne/exwm-modeline")
:config
(add-hook 'exwm-init-hook #'exwm-modeline-mode)
(my/use-doom-colors
(my/use-colors
(exwm-modeline-current-workspace
:foreground (doom-color 'yellow)
:foreground (my/color-value 'yellow)
:weight 'bold)))
(require 'windmove)

View file

@ -19,36 +19,13 @@ References:
* Global customization
** Colors
My favorite color theme is Palenight ([[https://github.com/JonathanSpeek/palenight-iterm2][color codes]]), and I want to have one source of truth for these colors. Except for Emacs itself, which has [[https://github.com/doomemacs/themes#theme-list][doom-palenight]] (and in which I occasionally switch to =doom-one-light=, e.g. when reading a long text), it can be done rather nicely with Org Mode.
I used to define color codes here (see [[https://github.com/SqrtMinusOne/dotfiles/commit/2dbf1cdd008ec0061456782cca3ebd76e603b31e][previous version of the file]]), now I just get colors from the current Emacs theme.
First, let's define a table with all the color codes:
#+tblname: colors
| color | key | value |
|---------------+---------+---------|
| black | color0 | #292d3e |
| red | color1 | #f07178 |
| green | color2 | #c3e88d |
| yellow | color3 | #ffcb6b |
| blue | color4 | #82aaff |
| magenta | color5 | #c792ea |
| cyan | color6 | #89ddff |
| white | color7 | #d0d0d0 |
| light-black | color8 | #434758 |
| light-red | color9 | #ff8b92 |
| light-green | color10 | #ddffa7 |
| light-yellow | color11 | #ffe585 |
| light-blue | color12 | #9cc4ff |
| light-magenta | color13 | #e1acff |
| light-cyan | color14 | #a3f7ff |
| light-white | color15 | #ffffff |
| color-fg | | #000000 |
The table above is the only source of truth for colors in this config.
Contents of this table can then be [[https://orgmode.org/manual/Environment-of-a-Code-Block.html][accessed from a code block]]. Let's define one to return the color code based on its name:
To use them, let's define a noweb block:
#+NAME: get-color
#+begin_src emacs-lisp :var table=colors name="black" quote=0
(let ((color (seq-some (lambda (e) (and (string= name (car e)) (nth 2 e))) table)))
#+begin_src emacs-lisp :var name="black" quote=0
(let ((color (or (my/color-value name)
(my/color-value (intern name)))))
(if (> quote 0)
(concat "\"" color "\"")
color))
@ -60,7 +37,28 @@ Test:
#+end_src
#+RESULTS:
: #f07178
: #ff5370
This tables used to have values, now it has only keys:
#+tblname: colors
| color | key |
|---------------+---------|
| black | color0 |
| red | color1 |
| green | color2 |
| yellow | color3 |
| blue | color4 |
| magenta | color5 |
| cyan | color6 |
| white | color7 |
| light-black | color8 |
| light-red | color9 |
| light-green | color10 |
| light-yellow | color11 |
| light-blue | color12 |
| light-magenta | color13 |
| light-cyan | color14 |
| light-white | color15 |
** Xresources
*** Colors in Xresources
@ -70,7 +68,7 @@ However, I'd rather use the =Xresources= file wherever possible. Here is the cod
#+begin_src emacs-lisp :var table=colors
(mapconcat
(lambda (elem)
(concat "*" (nth 1 elem) ": " (nth 2 elem)))
(concat "*" (nth 1 elem) ": " (my/color-value (nth 0 elem))))
(seq-filter
(lambda (elem) (and (nth 1 elem)
(not (string-empty-p (nth 1 elem)))))
@ -81,8 +79,8 @@ However, I'd rather use the =Xresources= file wherever possible. Here is the cod
#+begin_src conf-xdefaults :noweb yes :tangle ~/.Xresources
<<get-xresources()>>
*background: <<get-color(name="black")>>
*foreground: <<get-color(name="white")>>
*background: <<get-color(name="bg")>>
*foreground: <<get-color(name="fg")>>
#+end_src
So, whenever a program is capable of reading =.Xresources=, it will get colors from there, otherwise, it will get colors from noweb expressions in the literate config. Thus, in both cases, the color is set in a single Org Mode table.
@ -264,9 +262,9 @@ Show the current workspace in the modeline.
:straight (:host github :repo "SqrtMinusOne/exwm-modeline")
:config
(add-hook 'exwm-init-hook #'exwm-modeline-mode)
(my/use-doom-colors
(my/use-colors
(exwm-modeline-current-workspace
:foreground (doom-color 'yellow)
:foreground (my/color-value 'yellow)
:weight 'bold)))
#+end_src
** Windows
@ -1790,7 +1788,7 @@ The "colors" part is straightforward enough. Polybar can use =Xresources=, so we
<<get-polybar-colors()>>
background = ${xrdb:background}
; foreground = ${xrdb:foreground}
foreground = ${xrdb:color0}
#+end_src
*** Glyph settings
As for the module decorations though, I find it ironic that with all this fancy rendering around I have to resort to Unicode glyphs.
@ -2198,6 +2196,8 @@ label-muted = MUTE
format-volume-background = <<get-polybar-bg(module="pulseaudio")>>
format-muted-background = <<get-polybar-bg(module="pulseaudio")>>
format-volume-foreground = ${colors.foreground}
format-muted-foreground = ${colors.foreground}
; format-volume-underline = ${colors.white}
; format-muted-underline = ${colors.light-black}
@ -2225,6 +2225,9 @@ label-song-ellipsis = true
format-playing-background = <<get-polybar-bg(module="mpd")>>
format-paused-background = <<get-polybar-bg(module="mpd")>>
format-stopped-background = <<get-polybar-bg(module="mpd")>>
format-playing-foreground = ${colors.foreground}
format-paused-foreground = ${colors.foreground}
format-stopped-foreground = ${colors.foreground}
label-separator = 0
separator-foreground = ${colors.red}
@ -2244,6 +2247,7 @@ type = internal/cpu
format = " <label>"
label = %percentage%%
format-background = <<get-polybar-bg(module="cpu")>>
format-foreground = ${colors.foreground}
#+end_src
*** ram-memory
RAM usage
@ -2266,6 +2270,7 @@ label=%gb_used:.1f%
; format-underline = ${colors.blue}
format-background = <<get-polybar-bg(module="ram-memory")>>
format-foreground = ${colors.foreground}
#+end_src
*** swap-memory
@ -2277,6 +2282,7 @@ interval = 10
label= %gb_swap_used:.1f%
format-background = <<get-polybar-bg(module="swap-memory")>>
format-foreground = ${colors.foreground}
#+end_src
*** network
@ -2300,6 +2306,8 @@ label-disconnected = X
; format-disconnected-underline = ${colors.red}
format-connected-background = <<get-polybar-bg(module="network")>>
format-disconnected-background = <<get-polybar-bg(module="network")>>
format-connected-foreground = ${colors.foreground}
format-disconnected-foreground = ${colors.foreground}
ramp-signal-0 = 0
ramp-signal-1 = 1
@ -2320,6 +2328,7 @@ interval = 0
tail = true
format-background = <<get-polybar-bg(module="bandwidth")>>
format-foreground = ${colors.foreground}
#+end_src
#+begin_src bash :tangle ./bin/polybar/bandwidth3.sh
@ -2481,6 +2490,7 @@ fi
type = custom/script
exec = /home/pavel/bin/polybar/openvpn.sh
format-background = <<get-polybar-bg(module="openvpn")>>
format-foreground = ${colors.foreground}
interval = 1200
#+end_src
*** xkeyboard
@ -2492,6 +2502,7 @@ format = <label-layout>
; format-underline = ${colors.magenta}
format-background = <<get-polybar-bg(module="xkeyboard")>>
format-foreground = ${colors.foreground}
label-layout = %icon%
layout-icon-0 = ru;RU
layout-icon-1 = us;US
@ -2509,6 +2520,7 @@ format-discharging = <ramp-capacity> <label-discharging>
format-discharging-background = <<get-polybar-bg(module="battery")>>
format-charging-background = <<get-polybar-bg(module="battery")>>
format-full-background = <<get-polybar-bg(module="battery")>>
format-foreground = ${colors.foreground}
label-discharging = %percentage%% %time%
label-charging =  %percentage%% %time%
@ -2544,6 +2556,7 @@ type = custom/script
exec = /home/pavel/bin/polybar/weather.sh
; format-underline = ${colors.red}
format-background = <<get-polybar-bg(module="weather")>>
format-foreground = ${colors.foreground}
interval = 1200
#+end_src
*** sun
@ -2587,6 +2600,7 @@ fi
type = custom/script
exec = /home/pavel/bin/polybar/sun.sh
format-background = <<get-polybar-bg(module="sun")>>
format-foreground = ${colors.foreground}
interval = 60
#+end_src
*** aw-afk
@ -2618,6 +2632,7 @@ type = custom/script
exec = /home/pavel/bin/polybar/aw_afk.sh
interval = 60
format-background = <<get-polybar-bg(module="aw-afk")>>
format-foreground = ${colors.foreground}
#+end_src
*** date
Current date
@ -2633,6 +2648,7 @@ time = %H:%M
time-alt = %H:%M:%S
format-background = <<get-polybar-bg(module="date")>>
format-foreground = ${colors.foreground}
label = "%date% %time%"
#+end_src
@ -2650,6 +2666,7 @@ type = custom/script
exec = /home/pavel/bin/polybar/pomm.sh
interval = 1
format-underline = ${colors.light-green}
format-foreground = ${colors.foreground}
#+end_src
*** SEP
A simple separator
@ -2735,7 +2752,7 @@ A theme, based on [[https://github.com/dracula/rofi][dracula theme]] for rofi, b
#'concat
(mapcar
(lambda (elem)
(concat (nth 0 elem) ": " (nth 2 elem) ";\n"))
(concat (nth 0 elem) ": " (my/color-value (nth 0 elem)) ";\n"))
table))
#+end_src
@ -2959,8 +2976,7 @@ As it overwrites its own config all the time, I do not keep the file in VC.
[General]
disabledTrayIcon=false
drawColor=#ff0000
drawThickness=0
saveAfterCopyPath=/home/pavel/Pictures
drawThickness=3
savePath=/home/pavel/Pictures
savePathFixed=false
showStartupLaunchMessage=false
@ -3497,24 +3513,26 @@ set recolor true
map <C-r> set recolor false
map <C-R> set recolor true
set recolor-lightcolor <<get-color(name="black", quote=1)>>
set recolor-lightcolor <<get-color(name="bg", quote=1)>>
set completion-bg <<get-color(name="black", quote=1)>>
set completion-bg <<get-color(name="bg", quote=1)>>
set completion-fg <<get-color(name="white", quote=1)>>
set completion-group-bg <<get-color(name="light-black", quote=1)>>
set completion-group-bg <<get-color(name="bg", quote=1)>>
set completion-group-fg <<get-color(name="white", quote=1)>>
set completion-highlight-bg <<get-color(name="magenta", quote=1)>>
set completion-highlight-fg <<get-color(name="black", quote=1)>>
set inputbar-bg <<get-color(name="black", quote=1)>>
set inputbar-bg <<get-color(name="bg", quote=1)>>
set inputbar-fg <<get-color(name="light-magenta", quote=1)>>
set statusbar-bg <<get-color(name="black", quote=1)>>
set statusbar-bg <<get-color(name="bg", quote=1)>>
set statusbar-fg <<get-color(name="light-magenta", quote=1)>>
set notification-error-bg <<get-color(name="red", quote=1)>>
set notification-error-fg <<get-color(name="color-fg", quote=1)>>
# set notification-error-fg <<get-color(name="color-fg", quote=1)>>
set notification-error-fg "#000000"
set notification-warning-bg <<get-color(name="yellow", quote=1)>>
set notification-warning-fg <<get-color(name="color-fg", quote=1)>>
# set notification-warning-fg <<get-color(name="color-fg", quote=1)>>
set notification-warning-fg "#000000"
#+end_src
* Various software
This section generates manifests for various desktop software that I'm using.