Rework solarized

This commit is contained in:
Jakob Lechner 2025-10-24 17:38:34 +02:00
parent 0a2a569682
commit c9a956bc63
4 changed files with 186 additions and 171 deletions

View file

@ -1,23 +1,68 @@
builtins.mapAttrs let
(_: hex: { colors = {
inherit hex; base00 = "#657b83";
rgb = builtins.concatStringsSep "," (map (f: toString (builtins.fromTOML "i = 0x${f hex}").i) (map (pos: builtins.substring pos 2) [ 1 3 5 ])); base01 = "#586e75";
}) base02 = "#073642";
base03 = "#002b36";
base0 = "#839496";
base1 = "#93a1a1";
base2 = "#eee8d5";
base3 = "#fdf6e3";
blue = "#268bd2";
cyan = "#2aa198";
green = "#859900";
magenta = "#d33682";
orange = "#cb4b16";
red = "#dc322f";
violet = "#6c71c4";
yellow = "#b58900";
};
common = {
base08 = colors.red;
base09 = colors.orange;
base0A = colors.yellow;
base0B = colors.green;
base0C = colors.cyan;
base0D = colors.blue;
base0E = colors.violet;
base0F = colors.magenta;
};
light = common // {
base00 = colors.base3;
base01 = colors.base2;
base02 = colors.base1;
base03 = colors.base0;
base04 = colors.base00;
base05 = colors.base01;
base06 = colors.base02;
base07 = colors.base03;
};
dark = common // {
base00 = colors.base03;
base01 = colors.base02;
base02 = colors.base01;
base03 = colors.base00;
base04 = colors.base0;
base05 = colors.base1;
base06 = colors.base2;
base07 = colors.base3;
};
toRgb = hex: builtins.concatStringsSep "," (
map
(
f: toString (builtins.fromTOML "i = 0x${f hex}").i
)
(
map (pos: builtins.substring pos 2) [ 1 3 5 ]
)
);
makeScheme = colors: {
hex = colors;
rgb = builtins.mapAttrs (_: hex: (toRgb hex)) colors;
};
in
{ {
base00 = "#657b83"; inherit colors;
base01 = "#586e75"; light = makeScheme light;
base02 = "#073642"; dark = makeScheme dark;
base03 = "#002b36";
base0 = "#839496";
base1 = "#93a1a1";
base2 = "#eee8d5";
base3 = "#fdf6e3";
blue = "#268bd2";
cyan = "#2aa198";
green = "#859900";
magenta = "#d33682";
orange = "#cb4b16";
red = "#dc322f";
violet = "#6c71c4";
yellow = "#b58900";
} }

View file

@ -363,40 +363,39 @@ in
}; };
}; };
xdg.configFile = { xdg.configFile =
"sway/light-theme".text = with solarized; '' let
client.focused ${base01.hex} ${blue.hex} ${base3.hex} ${blue.hex} ${blue.hex} makeTheme = scheme: ''
client.focused_inactive ${base2.hex} ${base2.hex} ${base01.hex} ${base0.hex} ${base2.hex} client.focused ${scheme.base05} ${scheme.base0D} ${scheme.base00} ${scheme.base0D} ${scheme.base0D}
client.unfocused ${base2.hex} ${base3.hex} ${base01.hex} ${base2.hex} ${base2.hex} client.focused_inactive ${scheme.base01} ${scheme.base01} ${scheme.base05} ${scheme.base03} ${scheme.base01}
client.urgent ${red.hex} ${red.hex} ${base3.hex} ${red.hex} ${red.hex} client.unfocused ${scheme.base01} ${scheme.base00} ${scheme.base05} ${scheme.base01} ${scheme.base01}
''; client.urgent ${scheme.base08} ${scheme.base08} ${scheme.base00} ${scheme.base08} ${scheme.base08}
"sway/dark-theme".text = with solarized; ''
client.focused ${base1.hex} ${blue.hex} ${base03.hex} ${blue.hex} ${blue.hex}
client.focused_inactive ${base02.hex} ${base02.hex} ${base1.hex} ${base03.hex} ${base02.hex}
client.unfocused ${base02.hex} ${base03.hex} ${base1.hex} ${base02.hex} ${base02.hex}
client.urgent ${red.hex} ${red.hex} ${base03.hex} ${red.hex} ${red.hex}
'';
"swaynag/config".text =
let
# adding it to the header doesnt work since the defaults overwrite it
commonConfig = /* ini */ ''
background=${lib.substring 1 6 solarized.base3.hex}
border-bottom=${lib.substring 1 6 solarized.base2.hex}
border=${lib.substring 1 6 solarized.base2.hex}
button-background=${lib.substring 1 6 solarized.base3.hex}
button-text=${lib.substring 1 6 solarized.base00.hex}
'';
in
/* ini */ ''
font=Monospace 12
[warning]
text=${lib.substring 1 6 solarized.yellow.hex}
${commonConfig}
[error]
text=${lib.substring 1 6 solarized.red.hex}
${commonConfig}
''; '';
}; in
{
"sway/light-theme".text = makeTheme solarized.light.hex;
"sway/dark-theme".text = makeTheme solarized.dark.hex;
"swaynag/config".text =
let
# adding it to the header doesnt work since the defaults overwrite it
commonConfig = /* ini */ ''
background=${lib.substring 1 6 solarized.colors.base3}
border-bottom=${lib.substring 1 6 solarized.colors.base2}
border=${lib.substring 1 6 solarized.colors.base2}
button-background=${lib.substring 1 6 solarized.colors.base3}
button-text=${lib.substring 1 6 solarized.colors.base00}
'';
in
/* ini */ ''
font=Monospace 12
[warning]
text=${lib.substring 1 6 solarized.colors.yellow}
${commonConfig}
[error]
text=${lib.substring 1 6 solarized.colors.red}
${commonConfig}
'';
};
}) })

View file

@ -18,7 +18,11 @@ let
thinsp = " "; thinsp = " ";
solarized = import ../solarized.nix; solarized = import ../solarized.nix;
solarizedColors = as: lib.strings.concatLines (lib.attrsets.mapAttrsToList (name: value: let color = solarized."${value}".hex; in "@define-color ${name} ${color};") as); solarizedColors = lib.attrsets.mapAttrsToList (name: color: "@define-color ${name} ${color};");
themeCss = {
light = lib.strings.concatLines (solarizedColors solarized.light.hex);
dark = lib.strings.concatLines (solarizedColors solarized.dark.hex);
};
in in
{ {
# home-managers waybar module performs additional checks that are overly strict # home-managers waybar module performs additional checks that are overly strict
@ -253,42 +257,8 @@ in
}; };
xdg.configFile = { xdg.configFile = {
"waybar/theme-light.css".text = solarizedColors { "waybar/theme-light.css".text = themeCss.light;
base00 = "base3"; "waybar/theme-dark.css".text = themeCss.dark;
base01 = "base2";
base02 = "base1";
base03 = "base0";
base04 = "base00";
base05 = "base01";
base06 = "base02";
base07 = "base03";
base08 = "red";
base09 = "orange";
base0A = "yellow";
base0B = "green";
base0C = "cyan";
base0D = "blue";
base0E = "violet";
base0F = "magenta";
};
"waybar/theme-dark.css".text = solarizedColors {
base00 = "base03";
base01 = "base02";
base02 = "base01";
base03 = "base00";
base04 = "base0";
base05 = "base1";
base06 = "base2";
base07 = "base3";
base08 = "red";
base09 = "orange";
base0A = "yellow";
base0B = "green";
base0C = "cyan";
base0D = "blue";
base0E = "violet";
base0F = "magenta";
};
"waybar/style.css".text = '' "waybar/style.css".text = ''
@import "theme.css"; @import "theme.css";

View file

@ -1,91 +1,92 @@
{ lib, ... }: { lib, ... }:
let let
solarized = import ../solarized.nix; inherit (import ../solarized.nix) colors;
in in
{ {
xdg.configFile = { xdg.configFile =
"wofi/color-light".text = lib.strings.concatLines (map (c: solarized."${c}".hex) [ let
"base3" commonColors = with colors; [
"base2" red
"base1" orange
"base0" yellow
"base00" green
"base01" cyan
"base02" blue
"base03" violet
"red" magenta
"orange" ];
"yellow" in
"green" {
"cyan" "wofi/color-light".text = with colors; lib.strings.concatLines (
"blue" [
"violet" base3
"magenta" base2
]); base1
"wofi/color-dark".text = lib.strings.concatLines (map (c: solarized."${c}".hex) [ base0
"base03" base00
"base02" base01
"base01" base02
"base00" base03
"base0" ] ++ commonColors
"base1" );
"base2" "wofi/color-dark".text = with colors; lib.strings.concatLines (
"base3" with colors; [
"red" base03
"orange" base02
"yellow" base01
"green" base00
"cyan" base0
"blue" base1
"violet" base2
"magenta" base3
]); ] ++ commonColors
"wofi/style.css".text = '' );
window { "wofi/style.css".text = ''
margin: 0px; window {
border: 3px solid --wofi-color1; margin: 0px;
border-radius: 8px; border: 3px solid --wofi-color1;
background-color: rgba(--wofi-rgb-color0,0.8); border-radius: 8px;
} background-color: rgba(--wofi-rgb-color0,0.8);
}
#input { #input {
margin: 5px; margin: 5px;
border: none; border: none;
color: --wofi-color4; color: --wofi-color4;
background-color: rgba(--wofi-rgb-color1,0.8); background-color: rgba(--wofi-rgb-color1,0.8);
} }
#inner-box { #inner-box {
margin: 5px; margin: 5px;
border: none; border: none;
background: none; background: none;
} }
#outer-box { #outer-box {
margin: 5px; margin: 5px;
border: none; border: none;
background: none; background: none;
} }
#scroll { #scroll {
margin: 0px; margin: 0px;
border: none; border: none;
} }
#text { #text {
margin: 5px; margin: 5px;
border: none; border: none;
color: --wofi-color4; color: --wofi-color4;
} }
#entry:selected { #entry:selected {
background-color: rgba(--wofi-rgb-color1,0.8); background-color: rgba(--wofi-rgb-color1,0.8);
} }
#entry:selected #text{ #entry:selected #text{
color: --wofi-color11; color: --wofi-color11;
} }
''; '';
}; };
} }