danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
1.16k stars 143 forks source link

[Feature] Get the closest color name #587

Closed anotherhadi closed 2 weeks ago

anotherhadi commented 2 weeks ago

For some apps, colors can only be sets with colors name (blue, cyan, black, white, ...) It would be cool to access the closest color name through config.lib.colors.name.baseXX or something like that.

danth commented 2 weeks ago

I believe this is already implemented upstream:

https://github.com/SenchoPens/base16.nix/blob/c89c8123310257f3ddc04cc59aa4b5573c6d515f/lib/colors.nix#L92-L107

anotherhadi commented 2 weeks ago

If I'm not mistaken, this is the inverse of what I need! The goal is to give a name for a specific base, and not a base for a specific name

trueNAHO commented 2 weeks ago

The goal is to give a name for a specific base, and not a base for a specific name

In the future, https://github.com/danth/stylix/issues/249#issuecomment-2012933635 would resolve this.

trueNAHO commented 2 weeks ago

@anotherhadi, should we close this issue as a duplicate of https://github.com/danth/stylix/issues/249?

anotherhadi commented 2 weeks ago

@anotherhadi, should we close this issue as a duplicate of https://github.com/danth/stylix/issues/249?

That's not mentioned but could be added in the comments of #249

trueNAHO commented 2 weeks ago

That's not mentioned but could be added in the comments of #249

For example, the Vim highlight groups would instantiate the following named colors:

                          *hl-ColorColumn*
ColorColumn   Used for the columns set with 'colorcolumn'.
                          *hl-Conceal*
Conceal       Placeholder characters substituted for concealed
      text (see 'conceallevel').
                          *hl-CurSearch*
CurSearch Used for highlighting a search pattern under the cursor
      (see 'hlsearch').

-- nvim --cmd 'help highlight-groups'