stylix
stylix copied to clipboard
treewide: adapt icon theme colors
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:
Nord:
Custom cyberpunk color scheme mode = "palette" colors = (base08-base0F) accentSaturation = "1" accentLightMultiply = "0.7"
Custom cyberpunk color scheme mode = "palette" colors = (base00-base0F) accentSaturation = "1" accentLightMultiply = "0.7":
Custom cyberpunk color scheme mode = "monochrome" colors = (base08-base0F) foregroundThreshold = "0.9" accentSaturation = "1" accentLightMultiply = "0.6"
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".
Here the accentSaturation and accentLightMultiply are not set, causing poor contrast for some icons. Custom cyberpunk color scheme, mode = "monochrome" colors = (base08-base0F)
Same settings, but icon theme is numix circle:
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
I'm wondering how we should add support for recoloring the wallpaper as well? @danth
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 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?
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 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?
If they're the only thing in propagatedBuildInputs
you could map the override function over that as part of the override
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
Any example configs on how to use this branch? The icon theme colors look great.
@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;
};
};
};
@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?
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 It's probably 53d1bb4007589157ab9d873a33217183dc60c00c. Any better way to do it?