Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
glen-84 opened this issue Dec 28, 2021 · 6 comments
Open

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

glen-84 opened this issue Dec 28, 2021 · 6 comments
Assignees
Labels
editor-color-picker Editor color picker widget issues feature-request Request for new features or functionality
Milestone

Comments

@glen-84
Copy link

glen-84 commented Dec 28, 2021

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.

@rebornix rebornix added editor-color-picker Editor color picker widget issues feature-request Request for new features or functionality *duplicate Issue identified as a duplicate of another issue(s) labels Jan 14, 2022
@glen-84
Copy link
Author

glen-84 commented Jan 15, 2022

@rebornix Please mention the issue that this duplicates. I searched before opening this, and again now, but I can't find one.

@rebornix rebornix reopened this Jan 31, 2022
@rebornix
Copy link
Member

I thought there is an easier one but I couldn't find it anymore. Let's use this issue to track CSS color level 4 syntax support.

@rebornix rebornix removed the *duplicate Issue identified as a duplicate of another issue(s) label Jan 31, 2022
@rebornix rebornix added this to the Backlog milestone Jan 31, 2022
@rebornix rebornix removed their assignment Dec 14, 2022
@aiday-mar aiday-mar self-assigned this Mar 3, 2023
@aiday-mar
Copy link
Contributor

This issue has been fixed since then

Image

@lachieh
Copy link

lachieh commented Dec 4, 2024

The picker still displays and cycles through the old syntax. The only one that uses the level 4 syntax is hwb but that is because it was only added in the level 4 spec. I don't think this is resolved.

css-picker.mp4

@aiday-mar
Copy link
Contributor

aiday-mar commented Dec 5, 2024

Hi thank you for your comment. Ah yes apologies I thought you meant using HSL values but you meant a different representation format for HSL. I will reopen the issue.

@aiday-mar aiday-mar reopened this Dec 5, 2024
@T3sT3ro
Copy link

T3sT3ro commented Mar 4, 2025

I think it was related to all Level 4 color syntax forms, which I also find lacking. I am currently looking into the VScode source myself.

To summarize:

  • named colors
  • hex values
  • rgb
  • rgba
  • hsl
  • hsla
  • hwb
  • lab
  • lch
  • oklab
  • oklch
  • color

With more and more libraries using oklch/oklab by default, this is becoming more and more important.

Should it go into /vscode/src/vs/editor/common/languages/defaultDocumentColorsComputer.ts or the css language server and use the ColorProvider API?

How much work would it be to also include support for var() and calc expressions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-color-picker Editor color picker widget issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

6 participants
@glen-84 @rebornix @lachieh @T3sT3ro @aiday-mar and others