auto gtk theme, unique palette

This commit is contained in:
atagen 2023-06-16 19:44:53 +10:00
parent 2c2987e35f
commit 26fd86bc0a
5 changed files with 172 additions and 39 deletions

68
gtk-theme.nix Normal file
View file

@ -0,0 +1,68 @@
{ pkgs }:
{ palette }:
let
rendersvg = pkgs.runCommand "rendersvg" { } ''
mkdir -p $out/bin
ln -s ${pkgs.resvg}/bin/resvg $out/bin/rendersvg
'';
in
pkgs.stdenv.mkDerivation rec {
name = "generated-gtk-theme-nix-rice";
src = pkgs.fetchFromGitHub {
owner = "nana-4";
repo = "materia-theme";
rev = "76cac96ca7fe45dc9e5b9822b0fbb5f4cad47984";
sha256 = "sha256-0eCAfm/MWXv6BbCl2vbVbvgv8DiUH09TAUhoKq7Ow0k=";
};
buildInputs = with pkgs; [
sassc
bc
which
rendersvg
meson
ninja
nodePackages.sass
gtk4.dev
optipng
];
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
HOME=/build
chmod 777 -R .
patchShebangs .
mkdir -p $out/share/themes
mkdir bin
sed -e 's/handle-horz-.*//' -e 's/handle-vert-.*//' -i ./src/gtk-2.0/assets.txt
cat > /build/gtk-colors << EOF
BTN_BG=${palette.bright.black}
BTN_FG=${palette.normal.blue}
FG=${palette.util.fg}
BG=${palette.util.bg}
HDR_BTN_BG=${palette.bright.black}
HDR_BTN_FG=${palette.normal.blue}
ACCENT_BG=${palette.bright.black}
ACCENT_FG=${palette.normal.yellow}
HDR_FG=${palette.util.fg}
HDR_BG=${palette.util.bg}
MATERIA_SURFACE=${palette.normal.black}
MATERIA_VIEW=${palette.util.bg}
MENU_BG=${palette.util.bg}
MENU_FG=${palette.util.fg}
SEL_BG=${palette.normal.black}
SEL_FG=${palette.normal.yellow}
TXT_BG=${palette.util.bg}
TXT_FG=${palette.util.fg}
WM_BORDER_FOCUS=${palette.normal.yellow}
WM_BORDER_UNFOCUS=${palette.normal.black}
UNITY_DEFAULT_LAUNCHER_STYLE=False
NAME="nix-rice"
MATERIA_STYLE_COMPACT=True
EOF
echo "Changing colours:"
./change_color.sh -o nix-rice /build/gtk-colors -i False -t "$out/share/themes"
chmod 555 -R .
'';
}

View file

@ -22,6 +22,7 @@ in {
clementine
inkscape
xfce.thunar
feh
zathura
@ -98,8 +99,8 @@ in {
gtk-theme.name
fonts.sans.name
icons.name
palette-shex.util.fg
palette-shex.normal.black
palette-shex.bright.yellow
palette-shex.util.bg
(builtins.toString borders.thickness)
(builtins.toString borders.rounding)
(builtins.toString borders.gaps_in)
@ -265,9 +266,9 @@ in {
"${pkgs.wlogout}/share/wlogout"
"${pkgs.wlogout}/etc/wlogout"
util.bg
util.fg
util.bg_sel
normal.yellow
normal.white
normal.black
normal.red
]
(builtins.readFile dots/wlogout/style.css));
};
@ -289,13 +290,13 @@ in {
radius = rounding;
};
colors = {
background = lib.strings.concatStrings [palette-hex.util.bg "FF"];
background = lib.strings.concatStrings [palette-hex.util.bg "A0"];
text = lib.strings.concatStrings [palette-hex.util.fg "FF"];
selection = lib.strings.concatStrings [palette-hex.util.bg_sel "FF"];
selection-text = lib.strings.concatStrings [palette-hex.bright.black "FF"];
selection-match = lib.strings.concatStrings [palette-hex.bright.green "FF"];
match = lib.strings.concatStrings [palette-hex.util.fg_sel "FF"];
border = lib.strings.concatStrings [palette-hex.util.fg "FF"];
selection = lib.strings.concatStrings [palette-hex.bright.yellow "FF"];
selection-text = lib.strings.concatStrings [palette-hex.util.bg "FF"];
selection-match = lib.strings.concatStrings [palette-hex.normal.green"FF"];
match = lib.strings.concatStrings [palette-hex.bright.green "FF"];
border = lib.strings.concatStrings [palette-hex.bright.yellow "FF"];
};
};
};
@ -341,8 +342,51 @@ in {
programs.helix = {
enable = true;
themes = with palette-hex; {
nix-rice = {
"ui.background" = { bg = util.bg; };
"ui.menu" = { fg = bright.cyan; bg = normal.black; };
"ui.menu.selected" = { modifiers = [ "reversed" ]; };
"ui.linenr" = { fg = bright.cyan; bg = normal.black; };
"ui.popup" = { bg = bright.black; };
"ui.linenr.selected" = { fg = normal.yellow; bg = normal.black; modifiers = [ "bold" ]; };
"ui.selection" = { fg = bright.yellow; bg = normal.blue; };
"ui.selection.primary" = { modifiers = [ "reversed" ]; };
"comment" = { fg = bright.magenta; modifiers = [ "italics" ]; };
"ui.statusline" = { fg = bright.cyan; bg = normal.black; };
"ui.statusline.inactive" = { modifiers = [ "reversed" ]; };
"ui.help" = { fg = normal.white; bg = bright.black; };
"ui.cursor" = { modifiers = [ "reversed" ]; };
"variable" = normal.green;
"variable.builtin" = normal.green;
"constant.numeric" = normal.blue;
"constant" = normal.cyan;
"attributes" = normal.yellow;
"type" = normal.yellow;
"ui.cursor.match" = { fg = normal.yellow; modifiers = [ "underlined" ]; };
"string" = normal.green;
"variable.other.member" = normal.red;
"constant.character.escape" = normal.cyan;
"function" = bright.blue;
"constructor" = normal.blue;
"special" = normal.blue;
"keyword" = normal.magenta;
"label" = normal.magenta;
"namespace" = normal.blue;
"diff.plus" = normal.green;
"diff.delta" = normal.yellow;
"diff.minus" = normal.red;
"diagnostic" = { modifiers = [ "underlined" ]; };
"ui.gutter" = { bg = normal.black; };
"info" = normal.blue;
"hint" = normal.magenta;
"debug" = normal.magenta;
"warning" = normal.yellow;
"error" = normal.red;
};
};
settings = {
theme = "everforest_dark";
theme = "nix-rice";
editor.lsp.display-messages = true;
};
};

26
pal.conf Normal file
View file

@ -0,0 +1,26 @@
color0 #12282a
color8 #202e2f
color1 #da5143
color9 #da827a
color2 #8cc992
color10 #c2dab0
color3 #ffb852
color11 #ffd292
color4 #5299ff
color12 #92beff
color5 #645ac9
color13 #928cc9
color6 #5abfc9
color14 #8cc4c9
color7 #b0c2da
color15 #caccce
background #272a2a
foreground #cecbca
selection_background #272a2a
selection_foreground #5299ff
cursor #da827a
cursor_text_color #529ff

View file

@ -1,12 +1,9 @@
final: prev:
with prev.lib.nix-rice; let
# theme = kitty-themes.parseTheme (
# builtins.fetchurl {
# url = "https://github.com/rebelot/kanagawa.nvim/blob/master/extras/kanagawa.conf?raw=true";
# sha256 = "1r95lkq24a2ygrjv1mkqfrksgfvnyc16xrsldw04phnsa555x51l";
# }
# );
theme = kitty-themes.getThemeByName "everforest_dark_hard";
theme = kitty-themes.parseTheme (
./pal.conf
);
# theme = kitty-themes.getThemeByName "everforest_dark_hard";
in rec {
rice = {
palette =
@ -24,23 +21,17 @@ in rec {
white = theme.color7;
};
bright =
palette.brighten 15 normal
palette.defaultPalette
// {
black = theme.color8;
red = theme.color9;
green = theme.color10;
yellow = theme.color11;
blue = theme.color12;
magenta = theme.color13;
cyan = theme.color14;
white = theme.color15;
};
# bright =
# palette.defaultPalette
# // {
# black = theme.color8;
# red = theme.color9;
# green = theme.color10;
# yellow = theme.color11;
# blue = theme.color12;
# magenta = theme.color13;
# cyan = theme.color14;
# white = theme.color15;
# };
util =
palette.defaultPalette
// {
@ -49,7 +40,7 @@ in rec {
fg_sel = theme.selection_foreground;
bg_sel = theme.selection_background;
cursor = theme.cursor;
url = theme.url_color;
# url = theme.url_color;
};
}
// theme;
@ -95,8 +86,10 @@ in rec {
};
gtk-theme = {
name = "Everforest-Dark";
package = final.everforest-theme;
name = "nix-rice";
package = (prev.callPackage ./gtk-theme.nix {} { palette = palette.toRGBShortHex final.rice.palette; });
# name = "Everforest-Dark";
# package = final.everforest-theme;
};
@ -108,10 +101,11 @@ in rec {
};
bg = {
image = prev.fetchurl {
url = "https://github.com/Apeiros-46B/everforest-walls/blob/main/close_up/circuit_1.png?raw=true";
sha256 = "sha256-5V9XlJtC8n3zZueg5y/pWW1Oz75YPcEydLU/E/+z+2k=";
};
image = /home/bolt/Code/lutgen-rs/lutgen/wallhaven-rrokpj_custom.png;
# image = prev.fetchurl {
# url = "https://github.com/Apeiros-46B/everforest-walls/blob/main/close_up/circuit_1.png?raw=true";
# sha256 = "sha256-5V9XlJtC8n3zZueg5y/pWW1Oz75YPcEydLU/E/+z+2k=";
# };
};
}; # /rice
}

View file

@ -128,6 +128,7 @@
};
users.defaultUserShell = pkgs.zsh;
services.tumbler.enable = true; # thumbnailer for thunar
services.tailscale.enable = true;
environment.systemPackages = with pkgs; [