refactor gtk and qt themes

This commit is contained in:
Sean Kovacs 2026-01-07 14:04:41 -05:00
commit 14e786684c
Signed by: sckova
GPG key ID: 00F325187C68651A
4 changed files with 258 additions and 329 deletions

112
flake.lock generated
View file

@ -21,27 +21,6 @@
"type": "github"
}
},
"banner": {
"inputs": {
"nixpkgs": [
"gtk-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1669224926,
"narHash": "sha256-UK19yx8jNqbPfBZNUeJr2Sms7BhbDAUyJBF5w2CT6Hc=",
"owner": "the-argus",
"repo": "banner.nix",
"rev": "253556f4068f5cb9728e49ac42d630cdc0ccfd58",
"type": "github"
},
"original": {
"owner": "the-argus",
"repo": "banner.nix",
"type": "github"
}
},
"cachyos-kernel": {
"flake": false,
"locked": {
@ -200,44 +179,6 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gtk-nix": {
"inputs": {
"banner": "banner",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1692384535,
"narHash": "sha256-lFOEsDLV7kuEAcHS7HfyGewTcdSkzTxM+l3XwGhzLgU=",
"owner": "the-argus",
"repo": "gtk-nix",
"rev": "e77b9e68aa818b87389c682b4fd018ad451a85d3",
"type": "github"
},
"original": {
"owner": "the-argus",
"repo": "gtk-nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -322,7 +263,7 @@
"cachyos-kernel-patches": "cachyos-kernel-patches",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1767635460,
@ -340,17 +281,18 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1692264070,
"narHash": "sha256-WepAkIL2UcHOj7JJiaFS/vxrA9lklQHv8p+xGL+7oQ0=",
"lastModified": 1767593864,
"narHash": "sha256-AtzRYWSxsyvySDzfOek0lKQXoQrHtpFHbBPZ6rdQIEA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "42c25608aa2ad4e5d3716d8d63c606063513ba33",
"rev": "1b717f421d250290b16de9a6033ea28258c46ae1",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
"owner": "NixOS",
"ref": "nixos-unstable-small",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
@ -385,22 +327,6 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1767593864,
"narHash": "sha256-AtzRYWSxsyvySDzfOek0lKQXoQrHtpFHbBPZ6rdQIEA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1b717f421d250290b16de9a6033ea28258c46ae1",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable-small",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1767388185,
"narHash": "sha256-bmDUBlqgpIAXQ0QFn1fWpurlc+j2sI+B5941PWsic3M=",
@ -422,7 +348,7 @@
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_2"
"systems": "systems"
},
"locked": {
"lastModified": 1767608728,
@ -507,11 +433,10 @@
"apple-silicon": "apple-silicon",
"catppuccin": "catppuccin",
"catppuccin-palette": "catppuccin-palette",
"gtk-nix": "gtk-nix",
"home-manager": "home-manager",
"niri": "niri",
"nix-cachyos-kernel": "nix-cachyos-kernel",
"nixpkgs": "nixpkgs_3",
"nixpkgs": "nixpkgs_2",
"nixvim": "nixvim",
"noctalia": "noctalia",
"nur": "nur",
@ -524,7 +449,7 @@
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_3"
"systems": "systems_2"
},
"locked": {
"lastModified": 1767502559,
@ -570,21 +495,6 @@
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"xwayland-satellite-stable": {
"flake": false,
"locked": {

View file

@ -1,122 +1,10 @@
{
config,
pkgs,
lib,
...
}: let
colors = pkgs.catppuccin.hex.${config.catppuccin.flavor};
}: {
imports = [./gtk.nix ./qt.nix];
mkColorSection = name: value: "@define-color ${name} ${value};";
gtk4CSS = ''
/* Catppuccin ${lib.toUpper (builtins.substring 0 1 config.catppuccin.flavor)}${builtins.substring 1 (-1) config.catppuccin.flavor} ${lib.toUpper (builtins.substring 0 1 config.catppuccin.accent)}${builtins.substring 1 (-1) config.catppuccin.accent} Palette */
/* Base colors */
${mkColorSection "window_bg_color" colors.base}
${mkColorSection "window_fg_color" colors.text}
/* View styling */
${mkColorSection "view_bg_color" colors.base}
${mkColorSection "view_fg_color" colors.text}
/* Header bar */
${mkColorSection "headerbar_bg_color" colors.mantle}
${mkColorSection "headerbar_backdrop_color" colors.mantle}
${mkColorSection "headerbar_fg_color" colors.text}
/* Popovers and dialogs */
${mkColorSection "popover_bg_color" colors.base}
${mkColorSection "popover_fg_color" colors.text}
@define-color dialog_bg_color @popover_bg_color;
@define-color dialog_fg_color @popover_fg_color;
/* Cards and sidebars */
${mkColorSection "card_bg_color" colors.mantle}
${mkColorSection "card_fg_color" colors.text}
${mkColorSection "sidebar_bg_color" colors.mantle}
${mkColorSection "sidebar_fg_color" colors.text}
@define-color sidebar_backdrop_color @sidebar_bg_color;
${mkColorSection "sidebar_border_color" colors.surface0}
@define-color secondary_sidebar_bg_color @sidebar_bg_color;
@define-color secondary_sidebar_fg_color @sidebar_fg_color;
@define-color secondary_sidebar_backdrop_color @sidebar_backdrop_color;
@define-color secondary_sidebar_border_color @sidebar_border_color;
/* Catppuccin accent colors */
${mkColorSection "blue_1" colors.blue}
${mkColorSection "blue_2" colors.sapphire}
${mkColorSection "blue_3" colors.sky}
${mkColorSection "blue_4" colors.teal}
${mkColorSection "blue_5" colors.lavender}
${mkColorSection "green_1" colors.green}
${mkColorSection "green_2" colors.teal}
${mkColorSection "green_3" colors.sky}
${mkColorSection "green_4" colors.sapphire}
${mkColorSection "green_5" colors.blue}
${mkColorSection "yellow_1" colors.yellow}
${mkColorSection "yellow_2" colors.peach}
${mkColorSection "yellow_3" colors.yellow}
${mkColorSection "yellow_4" colors.red}
${mkColorSection "yellow_5" colors.maroon}
${mkColorSection "orange_1" colors.peach}
${mkColorSection "orange_2" colors.red}
${mkColorSection "orange_3" colors.maroon}
${mkColorSection "orange_4" colors.yellow}
${mkColorSection "orange_5" colors.green}
${mkColorSection "red_1" colors.red}
${mkColorSection "red_2" colors.maroon}
${mkColorSection "red_3" colors.pink}
${mkColorSection "red_4" colors.flamingo}
${mkColorSection "red_5" colors.rosewater}
${mkColorSection "purple_1" colors.mauve}
${mkColorSection "purple_2" colors.lavender}
${mkColorSection "purple_3" colors.pink}
${mkColorSection "purple_4" colors.flamingo}
${mkColorSection "purple_5" colors.rosewater}
${mkColorSection "brown_1" colors.surface2}
${mkColorSection "brown_2" colors.overlay0}
${mkColorSection "brown_3" colors.overlay1}
${mkColorSection "brown_4" colors.overlay2}
${mkColorSection "brown_5" colors.subtext1}
${mkColorSection "light_1" colors.text}
${mkColorSection "light_2" colors.subtext0}
${mkColorSection "light_3" colors.subtext1}
${mkColorSection "light_4" colors.blue}
${mkColorSection "light_5" colors.overlay0}
${mkColorSection "dark_1" colors.surface0}
${mkColorSection "dark_2" colors.surface1}
${mkColorSection "dark_3" colors.surface2}
${mkColorSection "dark_4" colors.mantle}
${mkColorSection "dark_5" colors.crust}
/* Custom rules */
toast {
background-color: @window_bg_color;
color: @window_fg_color;
}
toggle:checked {
background-color: @card_bg_color;
color: @window_fg_color;
}
.inline {
background-color: rgba(0, 0, 0, 0);
}
/* Accent */
${mkColorSection "accent_bg_color" colors.${config.catppuccin.accent}}
@define-color accent_fg_color @window_bg_color;
'';
in {
home.file = {
".icons/default/index.theme" = {
text = ''
@ -127,10 +15,6 @@ in {
'';
force = true;
};
".config/gtk-4.0/gtk.css" = {
text = gtk4CSS;
force = true;
};
};
home.pointerCursor = {
@ -182,114 +66,4 @@ in {
gtk-application-prefer-dark-theme = true;
};
};
qt = {
enable = true;
qt5ctSettings = {
Appearance = {
style = "Breeze";
icon_theme = config.gtk.iconTheme.name;
color_scheme_path = "/home/${config.userOptions.username}/.config/qt5ct/qt5ct.conf";
custom_palette = true;
standard_dialogs = "xdgdesktopportal";
};
Fonts = config.qt.qt6ctSettings.Fonts;
ColorScheme = config.qt.qt6ctSettings.ColorScheme;
};
qt6ctSettings = {
Appearance = {
style = "Breeze";
icon_theme = config.gtk.iconTheme.name;
color_scheme_path = "/home/${config.userOptions.username}/.config/qt6ct/qt6ct.conf";
custom_palette = true;
standard_dialogs = "xdgdesktopportal";
};
Fonts = {
fixed = "\"${config.userOptions.fontMono.name},${toString config.userOptions.fontMono.size}\"";
general = "\"${config.userOptions.fontSans.name},${toString config.userOptions.fontSans.size}\"";
};
ColorScheme = let
c = pkgs.catppuccin.bare.${config.catppuccin.flavor};
accent = c.${config.catppuccin.accent};
mkColors = roles: builtins.concatStringsSep ", " (map (r: "#ff${r}") roles);
in {
active_colors = mkColors [
c.text
c.surface0
c.surface1
c.surface0
c.base
c.mantle
c.text
c.text
c.text
c.base
c.mantle
c.crust
accent
c.base
accent
c.mauve
c.mantle
"000000"
c.base
c.text
c.overlay0
accent
];
disabled_colors = mkColors [
c.overlay0
c.surface0
c.surface1
c.surface0
c.overlay0
c.mantle
c.overlay0
c.text
c.overlay0
c.surface0
c.surface0
c.mantle
c.overlay1
c.text
"0000ff"
"ff00ff"
c.surface0
"000000"
c.surface0
c.base
"80000000"
c.overlay1
];
inactive_colors = mkColors [
c.text
c.surface0
c.surface1
c.surface0
c.base
c.mantle
c.text
c.text
c.text
c.base
c.mantle
c.crust
accent
c.base
accent
c.mauve
c.mantle
"000000"
c.base
c.text
c.overlay0
accent
];
};
};
};
}

130
home/theming/gtk.nix Normal file
View file

@ -0,0 +1,130 @@
{
config,
pkgs,
lib,
...
}: let
colors = pkgs.catppuccin.hex.${config.catppuccin.flavor};
mkColorSection = name: value: "@define-color ${name} ${value};";
generateCSS = ''
/* Catppuccin ${lib.toUpper (builtins.substring 0 1 config.catppuccin.flavor)}${builtins.substring 1 (-1) config.catppuccin.flavor} ${lib.toUpper (builtins.substring 0 1 config.catppuccin.accent)}${builtins.substring 1 (-1) config.catppuccin.accent} Palette */
/* Base colors */
${mkColorSection "window_bg_color" colors.base}
${mkColorSection "window_fg_color" colors.text}
/* View styling */
${mkColorSection "view_bg_color" colors.base}
${mkColorSection "view_fg_color" colors.text}
/* Header bar */
${mkColorSection "headerbar_bg_color" colors.mantle}
${mkColorSection "headerbar_backdrop_color" colors.mantle}
${mkColorSection "headerbar_fg_color" colors.text}
/* Popovers and dialogs */
${mkColorSection "popover_bg_color" colors.base}
${mkColorSection "popover_fg_color" colors.text}
@define-color dialog_bg_color @popover_bg_color;
@define-color dialog_fg_color @popover_fg_color;
/* Cards and sidebars */
${mkColorSection "card_bg_color" colors.mantle}
${mkColorSection "card_fg_color" colors.text}
${mkColorSection "sidebar_bg_color" colors.mantle}
${mkColorSection "sidebar_fg_color" colors.text}
@define-color sidebar_backdrop_color @sidebar_bg_color;
${mkColorSection "sidebar_border_color" colors.surface0}
@define-color secondary_sidebar_bg_color @sidebar_bg_color;
@define-color secondary_sidebar_fg_color @sidebar_fg_color;
@define-color secondary_sidebar_backdrop_color @sidebar_backdrop_color;
@define-color secondary_sidebar_border_color @sidebar_border_color;
/* Catppuccin accent colors */
${mkColorSection "blue_1" colors.blue}
${mkColorSection "blue_2" colors.sapphire}
${mkColorSection "blue_3" colors.sky}
${mkColorSection "blue_4" colors.teal}
${mkColorSection "blue_5" colors.lavender}
${mkColorSection "green_1" colors.green}
${mkColorSection "green_2" colors.teal}
${mkColorSection "green_3" colors.sky}
${mkColorSection "green_4" colors.sapphire}
${mkColorSection "green_5" colors.blue}
${mkColorSection "yellow_1" colors.yellow}
${mkColorSection "yellow_2" colors.peach}
${mkColorSection "yellow_3" colors.yellow}
${mkColorSection "yellow_4" colors.red}
${mkColorSection "yellow_5" colors.maroon}
${mkColorSection "orange_1" colors.peach}
${mkColorSection "orange_2" colors.red}
${mkColorSection "orange_3" colors.maroon}
${mkColorSection "orange_4" colors.yellow}
${mkColorSection "orange_5" colors.green}
${mkColorSection "red_1" colors.red}
${mkColorSection "red_2" colors.maroon}
${mkColorSection "red_3" colors.pink}
${mkColorSection "red_4" colors.flamingo}
${mkColorSection "red_5" colors.rosewater}
${mkColorSection "purple_1" colors.mauve}
${mkColorSection "purple_2" colors.lavender}
${mkColorSection "purple_3" colors.pink}
${mkColorSection "purple_4" colors.flamingo}
${mkColorSection "purple_5" colors.rosewater}
${mkColorSection "brown_1" colors.surface2}
${mkColorSection "brown_2" colors.overlay0}
${mkColorSection "brown_3" colors.overlay1}
${mkColorSection "brown_4" colors.overlay2}
${mkColorSection "brown_5" colors.subtext1}
${mkColorSection "light_1" colors.text}
${mkColorSection "light_2" colors.subtext0}
${mkColorSection "light_3" colors.subtext1}
${mkColorSection "light_4" colors.blue}
${mkColorSection "light_5" colors.overlay0}
${mkColorSection "dark_1" colors.surface0}
${mkColorSection "dark_2" colors.surface1}
${mkColorSection "dark_3" colors.surface2}
${mkColorSection "dark_4" colors.mantle}
${mkColorSection "dark_5" colors.crust}
/* Custom rules */
toast {
background-color: @window_bg_color;
color: @window_fg_color;
}
toggle:checked {
background-color: @card_bg_color;
color: @window_fg_color;
}
.inline {
background-color: rgba(0, 0, 0, 0);
}
/* Accent */
${mkColorSection "accent_bg_color" colors.${config.catppuccin.accent}}
@define-color accent_fg_color @window_bg_color;
'';
in {
home.file = {
".config/gtk-4.0/gtk.css" = {
text = generateCSS;
force = true;
};
".config/gtk-3.0/gtk.css" = {
text = generateCSS;
force = true;
};
};
}

115
home/theming/qt.nix Normal file
View file

@ -0,0 +1,115 @@
{
config,
pkgs,
...
}: {
qt = {
enable = true;
qt5ctSettings = {
Appearance = {
style = "Breeze";
icon_theme = config.gtk.iconTheme.name;
color_scheme_path = "/home/${config.userOptions.username}/.config/qt5ct/qt5ct.conf";
custom_palette = true;
standard_dialogs = "xdgdesktopportal";
};
Fonts = config.qt.qt6ctSettings.Fonts;
ColorScheme = config.qt.qt6ctSettings.ColorScheme;
};
qt6ctSettings = {
Appearance = {
style = "Breeze";
icon_theme = config.gtk.iconTheme.name;
color_scheme_path = "/home/${config.userOptions.username}/.config/qt6ct/qt6ct.conf";
custom_palette = true;
standard_dialogs = "xdgdesktopportal";
};
Fonts = {
fixed = "\"${config.userOptions.fontMono.name},${toString config.userOptions.fontMono.size}\"";
general = "\"${config.userOptions.fontSans.name},${toString config.userOptions.fontSans.size}\"";
};
ColorScheme = let
c = pkgs.catppuccin.bare.${config.catppuccin.flavor};
accent = c.${config.catppuccin.accent};
mkColors = roles: builtins.concatStringsSep ", " (map (r: "#ff${r}") roles);
in {
active_colors = mkColors [
c.text
c.surface0
c.surface1
c.surface0
c.base
c.mantle
c.text
c.text
c.text
c.base
c.mantle
c.crust
accent
c.base
accent
c.mauve
c.mantle
"000000"
c.base
c.text
c.overlay0
accent
];
disabled_colors = mkColors [
c.overlay0
c.surface0
c.surface1
c.surface0
c.overlay0
c.mantle
c.overlay0
c.text
c.overlay0
c.surface0
c.surface0
c.mantle
c.overlay1
c.text
"0000ff"
"ff00ff"
c.surface0
"000000"
c.surface0
c.base
"80000000"
c.overlay1
];
inactive_colors = mkColors [
c.text
c.surface0
c.surface1
c.surface0
c.base
c.mantle
c.text
c.text
c.text
c.base
c.mantle
c.crust
accent
c.base
accent
c.mauve
c.mantle
"000000"
c.base
c.text
c.overlay0
accent
];
};
};
};
}