ap / vim-css-color

Preview colours in source code while editing
http://www.vim.org/scripts/script.php?script_id=5056
MIT License
1.77k stars 78 forks source link

support for variables #134

Open mybigman opened 4 years ago

mybigman commented 4 years ago
:root {
  --gulf-blue: 55, 64, 87;
}

rgb(var(--gulf-blue));
rgba(var(--gulf-blue), 0.5);
ap commented 4 years ago

Yikes. That will be painful at best, if feasible at all. If not, it may instead be possible to highlight the definition (rather than individual uses). I don’t know. I’ll have to think about it.

Good to know that this is a thing people do in CSS now, though, thanks for alerting me.

adityashaw2 commented 1 year ago

My use case in CSS is like this:

html {
    --var-color-primary: #9C2646;
    --var-color-secondary: #E2525E;
}

.some-class {
    color: var(--var-color-secondary);
}

If --var-color-secondary text inside var() can be highlighted with the defined color, it would be of great help.