Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnome: accent color is no longer themed #662

Open
danth opened this issue Dec 5, 2024 · 1 comment
Open

gnome: accent color is no longer themed #662

danth opened this issue Dec 5, 2024 · 1 comment
Labels
bug Something isn't working properly

Comments

@danth
Copy link
Owner

danth commented Dec 5, 2024

Elements which use the accent color are now always the default blue.

This happens because GNOME 47 added support for a configurable accent color. The CSS now contains placeholders, namely -st-accent-color and -st-accent-fg-color, which are substituted with the configured accent color at runtime.

To progress, we either need to:

  • Replace the choices for the accent color with colors from our theme
  • Patch the JavaScript code to not use -st-accent-color

Both of these require patching GNOME Shell, which is not possible with Home Manager alone due to it being installed at the operating system level.

If we remove Home Manager support, we lose:

  • The ability to theme GNOME at all on non-NixOS
  • The ability to have per-user themes on NixOS

Reference: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2715

@danth danth added the bug Something isn't working properly label Dec 5, 2024
@danth
Copy link
Owner Author

danth commented Dec 5, 2024

For reference, this hardcodes a value into the CSS, but would require patching the JavaScript (and possibly other unknowns) to be fully effective.

diff --git a/modules/gnome/theme.nix b/modules/gnome/theme.nix
index 6a6ea7c..41c61d3 100644
--- a/modules/gnome/theme.nix
+++ b/modules/gnome/theme.nix
@@ -13,6 +13,15 @@ in stdenv.mkDerivation {
   postPatch = ''
     rm data/theme/gnome-shell-sass/{_colors.scss,_default-colors.scss,_palette.scss}
     cp ${colorsScss} data/theme/gnome-shell-sass/_colors.scss
+
+    substituteInPlace \
+      data/theme/gnome-shell-sass/**/*.scss \
+      --replace-quiet '-st-accent-color' '#${colors.base0D-hex}' \
+      --replace-quiet '-st-accent-fg-color' '#${colors.base00-hex}' \
+      --replace-quiet 'st-transparentize' 'transparentize' \
+      --replace-quiet 'st-mix' 'mix' \
+      --replace-quiet 'st-darken' 'darken' \
+      --replace-quiet 'st-lighten' 'lighten'
   '';
 
   nativeBuildInputs = [ sass glib.dev ];

@danth danth changed the title gnome: accent color is not themed gnome: accent color is no longer themed Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly
Projects
None yet
Development

No branches or pull requests

1 participant