From 564f9963e1b95275e7a62181a8e6371fa688762e Mon Sep 17 00:00:00 2001 From: Louis Dalibard Date: Tue, 24 Dec 2024 16:19:59 +0100 Subject: [PATCH] yes --- docs/src/configuration.md | 4 ++-- modules/gnome/hm.nix | 2 +- modules/kubecolor/hm.nix | 10 +++++++-- modules/qutebrowser/hm.nix | 4 ++-- stylix/hm/icon.nix | 44 +++++++++++++++++++++----------------- 5 files changed, 37 insertions(+), 27 deletions(-) diff --git a/docs/src/configuration.md b/docs/src/configuration.md index 9f51a1c..cdb0191 100644 --- a/docs/src/configuration.md +++ b/docs/src/configuration.md @@ -47,11 +47,11 @@ If you only set a wallpaper, Stylix will use a to create a color scheme. The quality of these schemes can vary, but more colorful images tend to have better results. -You can force a light or dark scheme using the polarity option: +You can force a light or dark scheme using the `polarity.force` option: ```nix { - stylix.polarity = "dark"; + stylix.force.polarity = "dark"; } ``` diff --git a/modules/gnome/hm.nix b/modules/gnome/hm.nix index c884ad3..81dca18 100644 --- a/modules/gnome/hm.nix +++ b/modules/gnome/hm.nix @@ -37,7 +37,7 @@ in { # settings tile is removed. The value is still used by Epiphany to # request dark mode for websites which support it. color-scheme = - if config.stylix.polarity == "dark" + if config.stylix.polarity.force == "dark" then "prefer-dark" else "default"; diff --git a/modules/kubecolor/hm.nix b/modules/kubecolor/hm.nix index 378e3fc..86224bb 100644 --- a/modules/kubecolor/hm.nix +++ b/modules/kubecolor/hm.nix @@ -1,10 +1,16 @@ -{ config, lib, ... }: { + config, + lib, + ... +}: { options.stylix.targets.kubecolor.enable = config.lib.stylix.mkEnableTarget "kubecolor" true; config = lib.mkIf config.stylix.targets.kubecolor.enable { programs.kubecolor.settings = { - preset = if config.stylix.polarity == "either" then "" else "${config.stylix.polarity}"; + preset = + if config.stylix.polarity.force == "either" + then "" + else "${config.stylix.polarity.force}"; theme = { base = { info = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; diff --git a/modules/qutebrowser/hm.nix b/modules/qutebrowser/hm.nix index d1b748e..4e9db0f 100644 --- a/modules/qutebrowser/hm.nix +++ b/modules/qutebrowser/hm.nix @@ -248,13 +248,13 @@ in { }; webpage = let - isDark = config.stylix.polarity == "dark"; + isDark = config.stylix.polarity.force == "dark"; in { darkmode.enabled = lib.mkIf isDark (lib.mkDefault true); preferred_color_scheme = lib.mkIf - isDark (lib.mkDefault config.stylix.polarity); + isDark (lib.mkDefault config.stylix.polarity.force); }; }; diff --git a/stylix/hm/icon.nix b/stylix/hm/icon.nix index c0d9fdd..b161540 100644 --- a/stylix/hm/icon.nix +++ b/stylix/hm/icon.nix @@ -1,22 +1,26 @@ -{ config, lib, ... }: - -let - cfg = config.stylix.iconTheme; - inherit (config.stylix) polarity; +{ + config, + lib, + ... +}: let + cfg = config.stylix.iconTheme; + inherit (config.stylix) polarity; in { - imports = [ ../icon.nix ]; - config = lib.mkIf (config.stylix.enable && cfg.enable) { - gtk = { - iconTheme = { - inherit (cfg) package; - name = builtins.head (lib.filter (x: null != x) [ - ({ - inherit (cfg) dark light; - }."${polarity}" or null) - cfg.dark - cfg.light - ]); - }; - }; - }; + imports = [../icon.nix]; + config = lib.mkIf (config.stylix.enable && cfg.enable) { + gtk = { + iconTheme = { + inherit (cfg) package; + name = builtins.head (lib.filter (x: null != x) [ + ({ + inherit (cfg) dark light; + } + ."${polarity.force}" + or null) + cfg.dark + cfg.light + ]); + }; + }; + }; }