stylix icon indicating copy to clipboard operation
stylix copied to clipboard

treewide: adapt icon theme colors

Open Kasper24 opened this issue 1 year ago • 15 comments

I've been using this in my personal configuration for a bit, but not sure if you guys will be interested in this. The script is a modified and stripped down version of color-manager.

One issue that I'm having is with parent themes. They should always be accessible in propagatedbuildinputs, but I'm unsure how to dynamically adjust them. Additionally, this script could potentially be expanded to recolor wallpapers, but that would require some adjustments as well.

Examples: Gruvbox: image

Nord: image

Custom cyberpunk color scheme mode = "palette" colors = (base08-base0F) accentSaturation = "1" accentLightMultiply = "0.7"

6

Custom cyberpunk color scheme mode = "palette" colors = (base00-base0F) accentSaturation = "1" accentLightMultiply = "0.7":

7

Custom cyberpunk color scheme mode = "monochrome" colors = (base08-base0F) foregroundThreshold = "0.9" accentSaturation = "1" accentLightMultiply = "0.6"

9

Custom cyberpunk color scheme This turns the foregrond colors black: mode = "monochrome" colors = (base08-base0F) foregroundThreshold = "0.9" accentSaturation = "1" accentLightMultiply = "0.6" foregroundSaturation = "0" foregroundLight = "0".

10

Here the accentSaturation and accentLightMultiply are not set, causing poor contrast for some icons. Custom cyberpunk color scheme, mode = "monochrome" colors = (base08-base0F)

11

Same settings, but icon theme is numix circle:

12

Kasper24 avatar Oct 01 '23 17:10 Kasper24

if were going to add a new package to stylix we might want to reorganise were it and the palate generator are place, ie putting them both into ./pkgs or something

SomeGuyNamedMay avatar Oct 02 '23 04:10 SomeGuyNamedMay

I'm wondering how we should add support for recoloring the wallpaper as well? @danth

Kasper24 avatar Oct 05 '23 02:10 Kasper24

After #102 is finished we should be able to add that as a function which takes in an image and a color scheme, and outputs the recoloured wallpaper.

danth avatar Oct 05 '23 09:10 danth

@danth What about recoloring the parent icon themes? For example in the "Numix Circle" theme the folder icons come from the parent "Numix" theme and those don't get recolored and look out of place. Surely there's a way?

Kasper24 avatar Oct 06 '23 20:10 Kasper24

I'm not too familiar with how icon themes are packaged in NixOS. If the parent theme is a separate package then we would need to override it from there. Does the Numix Circle theme depend on Numix or do you install them separately?

danth avatar Oct 08 '23 18:10 danth

@danth https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/icons/numix-icon-theme-circle/default.nix#L40 Every parent theme that the child theme inherits from should be part of propagatedBuildInputs. Is there some magic we can do to override those as well?

Kasper24 avatar Oct 12 '23 06:10 Kasper24

If they're the only thing in propagatedBuildInputs you could map the override function over that as part of the override

danth avatar Oct 12 '23 07:10 danth

If they're the only thing in propagatedBuildInputs you could map the override function over that as part of the override

Could you help me with that? I'm not quite sure how

Kasper24 avatar Oct 27 '23 19:10 Kasper24

Any example configs on how to use this branch? The icon theme colors look great.

donovanglover avatar Jan 03 '24 02:01 donovanglover

@donovanglover The modes property works as follows: -- monochrome: A monochromatic variant, colored by appropriate shades of the provided base color. -- palette: A multichromatic variant, where all colors are replaced by their nearest perceived equivalent that adheres to the provided color palette.

stylix.targets.iconTheme = {
    enable = true;
    name = "Zafiro-icons-Dark";
    package = pkgs.zafiro-icons;
    recolor = {
      enable = true;
      mode = "palette";
      colors = with config.lib.stylix.colors.withHashtag; [
        base00
        base01
        base02
        base03
        base04
        base05
        base06
        base07
        base08
        base09
        base0A
        base0B
        base0C
        base0D
        base0E
        base0F
      ];
      smooth = false;
    };
  };
};

Kasper24 avatar Feb 10 '24 17:02 Kasper24

@danth I added lots of options to better allow for adjusting the output, which helps icons that previously had very poor contrast when they got recolored. You can look at the new pics for examples. I'm wondering what needs to be done to get this merged?

Kasper24 avatar Feb 20 '24 15:02 Kasper24

When rebased on master, this branch causes an infinite recursion with my config:

error:
       … while calling the 'head' builtin

         at /nix/store/gzv0nsm8d5js3wzq2mr1sv9lfp1iyail-source/lib/attrsets.nix:960:11:

          959|         || pred here (elemAt values 1) (head values) then
          960|           head values
             |           ^
          961|         else

       … while evaluating the attribute 'value'

         at /nix/store/gzv0nsm8d5js3wzq2mr1sv9lfp1iyail-source/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: infinite recursion encountered

       at /nix/store/gzv0nsm8d5js3wzq2mr1sv9lfp1iyail-source/lib/modules.nix:233:21:

          232|           (regularModules ++ [ internalModule ])
          233|           ({ inherit lib options config specialArgs; } // specialArgs);
             |                     ^
          234|         in mergeModules prefix (reverseList collected);

danth avatar Feb 27 '24 13:02 danth

@danth It's probably 53d1bb4007589157ab9d873a33217183dc60c00c. Any better way to do it?

Kasper24 avatar Feb 29 '24 05:02 Kasper24