Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Support user defined color patterns #93

Open
pelegs opened this issue Oct 12, 2022 · 4 comments
Open

[Feature request] Support user defined color patterns #93

pelegs opened this issue Oct 12, 2022 · 4 comments

Comments

@pelegs
Copy link

pelegs commented Oct 12, 2022

Could look something like this:

require 'colorizer'.setup {
  '*';
  user_patterns = {
    'LaTeXHTML' = {
        'type' = 'RRGGBB',
        'pattern' = '\\{HTML\\}\\{([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})\\}',
    },
  }
}

In the above example we add a list of user-defined patterns. Each pattern gets a name (in this case there's only one, namely "LaTeXHTML") and a regex to match, where the specification for the regex is given by the type (e.g. RBG, RRGGBB, RRGGBBAAm etc.).

@XVilka
Copy link

XVilka commented Dec 16, 2022

This would be really awesome e.g. also to have rgb:XXX shortened or fullrgb:XXXXXX pattern.

@alex-ross
Copy link

I would like this as well. Perfect to highlight tailwind or bootstrap-colors, or some other internal color set.

@leana8959
Copy link

leana8959 commented Apr 6, 2023

Agree on this, fish configurations uses RRGGBB without the hash sign (it becomes a comment otherwise).
Adding custom regex support would make configuring my shell colorscheme so much easier!

Update:

For my purpose of visualizing colour codes in .fish files, I noticed that by simply commenting out these two early returns, it would work the specific way I want it to. Do note that this might reduce the performance for it has to check more strings.
hack
result

@naiveai
Copy link

naiveai commented Aug 25, 2023

I would also like this feature a lot, for Tailwind colors in my case, and I'm willing to try to work on it if someone could point me in the right direction, I'm a bit new to Lua Neovim plugins in general. Theoretically the idea seems simple enough, though I'm sure complications will come up in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants