[Feature request] Support user defined color patterns
pelegs opened this issue · 4 comments
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.).
This would be really awesome e.g. also to have rgb:XXX
shortened or fullrgb:XXXXXX
pattern.
I would like this as well. Perfect to highlight tailwind or bootstrap-colors, or some other internal color set.
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.
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.