gtk: tint surfaces off base00 like the shell, not stylix's off-hue base01

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-03 10:18:09 +01:00
parent eca4f6deec
commit 5aea7fab27

View file

@ -71,7 +71,15 @@
programs.xwayland.enable = true; programs.xwayland.enable = true;
programs.dconf.enable = true; programs.dconf.enable = true;
home-manager.users.fred = { config, lib, pkgs, ... }: { home-manager.users.fred = { config, lib, pkgs, ... }: let
# Scaling all three channels by the same factor is exactly what
# Qt.lighter() does — hue and HSV saturation stay put, only value moves —
# so this lands on the same surfaces as quickshell's Theme.base01/base02.
# GTK's own shade() can't stand in: it multiplies saturation too.
tint = f: let
ch = k: toString (builtins.floor (builtins.fromJSON config.lib.stylix.colors."base00-rgb-${k}" * f));
in "rgb(${ch "r"}, ${ch "g"}, ${ch "b"})";
in {
# Stylix's qt target only supports qtct; disable it to silence the warning. # Stylix's qt target only supports qtct; disable it to silence the warning.
stylix.targets.qt.enable = false; stylix.targets.qt.enable = false;
# Minimal titlebars — stylix manages the GTK theme; we layer our # Minimal titlebars — stylix manages the GTK theme; we layer our
@ -89,6 +97,18 @@
gtk.gtk3.extraConfig.gtk-application-prefer-dark-theme = true; gtk.gtk3.extraConfig.gtk-application-prefer-dark-theme = true;
stylix.targets.gtk.extraCss = '' stylix.targets.gtk.extraCss = ''
/* Surfaces: one hue, three steps the same ladder quickshell's Theme
uses (settings/quickshell.nix, commit e2c413d). Stylix paints every
raised surface with base01/base02, which come straight off the
wallpaper and routinely land off-hue: base01 is #3f3fab purple over a
slate #1c1f26 desktop, which is why nemo's delete dialog was blue. */
@define-color headerbar_bg_color ${tint 1.7};
@define-color sidebar_bg_color ${tint 1.7};
@define-color card_bg_color ${tint 1.7};
@define-color dialog_bg_color ${tint 1.7};
@define-color popover_bg_color ${tint 1.7};
@define-color scrollbar_outline_color ${tint 2.4};
headerbar { min-height: 0; padding: 0; margin: 0; } headerbar { min-height: 0; padding: 0; margin: 0; }
headerbar .title { font-size: 0; } headerbar .title { font-size: 0; }
window:backdrop { window:backdrop {