stylix icon indicating copy to clipboard operation
stylix copied to clipboard

dank-material-shell: option to choose the base16 colors for primary and secondary

Open alvarosth opened this issue 2 months ago • 0 comments

Description

The DankMaterialShell target hard-codes the shell's accent roles: primary and surfaceTint are base0D, and secondary is base0E (modules/dank-material-shell/hm.nix L34-L44 at 7c065d1; release-26.05 is identical).

I use DMS as my desktop shell, and the rest of my desktop uses base0E as its accent (focused window borders, for example). I want the shell's primary to follow that accent.

There are two workarounds today, and neither fits this well.

A global stylix.override that swaps base0D and base0E does reach the shell, because every view of the scheme is computed from it (stylix/palette.nix L170). But it remaps the two colors for every target. Terminal ANSI blue, for example, then takes the original base0E color (foot's regular4 and bright4 are base0D, modules/foot/hm.nix L30 and L38). The rest of my desktop, which reads base0E as its accent, would also get the old base0D, so the shell and the desktop would still disagree.

Per target, the only override that works is against the precomputed view that the target reads, as explained in #2164:

stylix.targets.dank-material-shell.colors.override.withHashtag = {
  base0D = config.lib.stylix.colors.withHashtag.base0E;
  base0E = config.lib.stylix.colors.withHashtag.base0D;
};

The more obvious colors.override = { base0D = …; base0E = …; } evaluates but changes nothing. mkTarget merges the override with lib.recursiveUpdate (stylix/mk-target.nix L224-L237), so only the top-level attributes change, while the target reads colors.withHashtag. The working form couples my configuration to which view the module reads. It also expresses "swap two palette entries" when what I mean is "use this color as primary".

Proposal: add two target options. Their defaults reproduce the current output exactly:

stylix.targets.dank-material-shell = {
  primary = "base0E";   # one of base08–base0F; default "base0D" (primary, surfaceTint)
  secondary = "base0D"; # one of base08–base0F; default "base0E"
};

This is a per-target choice, like waybar's font enum. The base16 scheme stays as it is, so the proposal is separate from the palette-wide accent discussed in #402 and #2404. Limiting the choice to base08–base0F follows the suggestion in #402 to let users pick their accent from those colors. The options only choose base16 slots, so the semantic color support pending in #892 could later supersede them or map onto them.

This covers the DMS target only. The sibling dank-calendar target writes the same theme format with the same mapping (modules/dank-calendar/hm.nix L15-L25), so the same two options could be added there if you want the two targets to match.

I have a patch for this and can open a PR if the approach is welcome.

Submission Checklist

  • [X] I assert that this issue is relevant to Stylix
  • [X] I assert that this is not a duplicate of an existing issue

Notify maintainers

@khas-amir @skiletro

alvarosth avatar Oct 03 '26 09:10 alvarosth