chrisbra / Colorizer

color hex codes and color names
547 stars 30 forks source link

hex_pattern question #81

Closed slipsnip closed 4 years ago

slipsnip commented 4 years ago

This is a question regarding the variable colorizer_hex_pattern and getting it to match rgb:a0/a0/a0 for example, found in a config file. I tried setting let g:colorizer_hex_pattern = ['rgb:', '\%(\x\{2}\/\?\)\{3}', '\>'] and toggling colorizer with :ColorToggle. I know that the colorizer is working because other colours in the file such as red are correctly rendered with a red background, but my hex_pattern seems ignored. If I try entering the pattern into a / search, it finds and highlights what I want to be colourized.

If you could lend any help with getting this to work that would be appreciated. Thank you.

slipsnip commented 4 years ago

To add further context of the use case, the configuration file I am editing states that colors must conform to the XQueryColor specification man 3 XQueryColor and search for color names.

chrisbra commented 4 years ago

Hm, need to check that.

chrisbra commented 4 years ago

It should work with a pattern like this:

     let g:colorizer_hex_pattern = ['rgb:', '\%(\x\x\/\x\x\/\x\x\)', '']

I don't have a manpage for XQueryColor, but I assume this should work.