Skip to content

How do I stop hex colors shorter than 6 characters from being highlighted #77

Closed Answered by uga-rosa
akinsho asked this question in Q&A
Discussion options

You must be logged in to vote

exclude_pattern option is now obsolete. It was intended to specify word boundaries, and I have decided that regular expressions \<, \> and [[:keyword:]] are sufficient for this purpose.
Everything passed to pickers in ccc.setup() is an object, and manipulating this entity will accomplish the goal. Specifically, HexPicker has a field called pattern, which can be rewritten.

local ccc = require("ccc")

local HexPicker = ccc.picker.hex
HexPicker.pattern = {
  [=[\v%(^|[^[:keyword:]])\zs#(\x\x)(\x\x)(\x\x)>]=],
  [=[\v%(^|[^[:keyword:]])\zs#(\x)(\x)(\x)>]=],
}

ccc.setup({
  -- Other options
  -- ...
  pickers = {
    HexPicker,
    ccc.picker.css_rgb,
    ccc.picker.css_hsl,
    ccc.picker.cs…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@akinsho
Comment options

@uga-rosa
Comment options

@akinsho
Comment options

Answer selected by uga-rosa
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants