This commit is contained in:
Louis Dalibard 2024-12-24 16:19:59 +01:00
parent c21c00e9cf
commit 564f9963e1
5 changed files with 37 additions and 27 deletions

View File

@ -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 to create a color scheme. The quality of these schemes can vary, but more
colorful images tend to have better results. 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 ```nix
{ {
stylix.polarity = "dark"; stylix.force.polarity = "dark";
} }
``` ```

View File

@ -37,7 +37,7 @@ in {
# settings tile is removed. The value is still used by Epiphany to # settings tile is removed. The value is still used by Epiphany to
# request dark mode for websites which support it. # request dark mode for websites which support it.
color-scheme = color-scheme =
if config.stylix.polarity == "dark" if config.stylix.polarity.force == "dark"
then "prefer-dark" then "prefer-dark"
else "default"; else "default";

View File

@ -1,10 +1,16 @@
{ config, lib, ... }:
{ {
config,
lib,
...
}: {
options.stylix.targets.kubecolor.enable = config.lib.stylix.mkEnableTarget "kubecolor" true; options.stylix.targets.kubecolor.enable = config.lib.stylix.mkEnableTarget "kubecolor" true;
config = lib.mkIf config.stylix.targets.kubecolor.enable { config = lib.mkIf config.stylix.targets.kubecolor.enable {
programs.kubecolor.settings = { 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 = { theme = {
base = { base = {
info = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}"; info = "fg=${config.lib.stylix.colors.withHashtag.base05-hex}";

View File

@ -248,13 +248,13 @@ in {
}; };
webpage = let webpage = let
isDark = config.stylix.polarity == "dark"; isDark = config.stylix.polarity.force == "dark";
in { in {
darkmode.enabled = lib.mkIf isDark (lib.mkDefault true); darkmode.enabled = lib.mkIf isDark (lib.mkDefault true);
preferred_color_scheme = preferred_color_scheme =
lib.mkIf lib.mkIf
isDark (lib.mkDefault config.stylix.polarity); isDark (lib.mkDefault config.stylix.polarity.force);
}; };
}; };

View File

@ -1,6 +1,8 @@
{ config, lib, ... }: {
config,
let lib,
...
}: let
cfg = config.stylix.iconTheme; cfg = config.stylix.iconTheme;
inherit (config.stylix) polarity; inherit (config.stylix) polarity;
in { in {
@ -12,7 +14,9 @@ in {
name = builtins.head (lib.filter (x: null != x) [ name = builtins.head (lib.filter (x: null != x) [
({ ({
inherit (cfg) dark light; inherit (cfg) dark light;
}."${polarity}" or null) }
."${polarity.force}"
or null)
cfg.dark cfg.dark
cfg.light cfg.light
]); ]);