Microsoft/vscode

Use modern (CSS color level 4) syntax for colors in the color picker

Open

#139,840 opened on Dec 28, 2021

View on GitHub
 (7 comments) (28 reactions) (1 assignee)TypeScript (10,221 forks)batch import
editor-color-pickerfeature-requesthelp wanted

Repository metrics

Stars
 (74,848 stars)
PR merge metrics
 (Avg merge 11h 43m) (1,000 merged PRs in 30d)

Description

When converting colors using the color picker, the old comma-based syntax is used:

image (it should also show hsl here, at the top of the picker, not rgba)

Please update the picker to use the modern (CSS color level 4) syntax for colors.

With regard to the exact syntax, I agree with these suggestions from @mathiasbynens:

  • consider being opinionated w.r.t. how to represent alpha values. IMHO using percentage notation is most readable, as it clarifies the range: e.g. 70% vs 0.7
  • consider being opinionated about using the deg suffix where applicable, e.g. in the first parameter for hsl() and the last non-alpha parameter for lch(). Again, because this clarifies that the range lies between 0-360.

i.e. Use percentages for alpha, and always include the deg suffix.

This also matches the syntax displayed in Chrome developer tools.

Contributor guide