catppuccin / nix

❄️ Soothing pastel theme for Nix
https://nix.catppuccin.com/
MIT License
415 stars 53 forks source link

Exposing color palette as read only options #348

Closed aciceri closed 1 month ago

aciceri commented 1 month ago

How do you see a set of read only options containing the colors palette of the selected flavor and accent?

The thing I prefer of this project is that I can switch between mocha and latte simply changing one option and rebuilding the configuration (or even using specialisations) but what happens if I've some custom configurations where I want to specify colors from the theme directly?

For instance I use zjstatus (a configurable status bar for zellij) and I created my custom bar where I specify colors for the components like this:

programs.zellij.layout = pkgs.writeText "layout.kdl" ''
  // ...
  format_left "{mode}#[bd=#1d1e2e] {tabs}"
  // ...
''

but I would like to do something like

programs.zellij.layout = pkgs.writeText "layout.kdl" ''
  // ...
  format_left "{mode}#[bd=#${config.catppuccin.palette.base}] {tabs}"
  // ...
''

so that when I change catppuccin.flavor everything changes smoothly.

It should be easy to implement, we could take the colors from here, since it's already a JSON it wouldn't require IFDs. I'm open to implement it myself.

cc @getchoo

aciceri commented 1 month ago

Just noticed that the exact same thing is already done for fzf here, in case my proposal is approved I would also refactor it to make it use the new centralized palette.

getchoo commented 1 month ago

As you noticed, this is already possible with catppuccin.sources. However as stated in https://github.com/catppuccin/nix/issues/96, this is not something I really want to do as we really shouldn't be pulling in the palette at all (we should be using the upstream port only), and hopefully one day we won't

This isn't considered stable functionality and is liable to break at any time; catppuccin.sources is only meant to be written to, not read from by end users