Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Switch to more modern hsl output format #14

Open
adrinux opened this issue Mar 16, 2021 · 3 comments
Open

Switch to more modern hsl output format #14

adrinux opened this issue Mar 16, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@adrinux
Copy link
Owner

adrinux commented Mar 16, 2021

Instead of

--colorname: hsla(190, 60%, 50%, 0.9);

drop the commas and use a forward slash for the alpha

--colorname: hsla(190 60% 50% / 0.9);

More readable and easier to type.

@adrinux adrinux self-assigned this Mar 16, 2021
@adrinux adrinux added the enhancement New feature or request label Mar 16, 2021
@adrinux
Copy link
Owner Author

adrinux commented Apr 14, 2021

This is not well enough supported by browsers as of April 202. Postponed.

@adrinux
Copy link
Owner Author

adrinux commented Oct 31, 2022

Support is good in 2022 (only old IE lacks support). Removing postponed label.

@adrinux adrinux changed the title Switch to more modern hsla output format Switch to more modern hsl output format Nov 3, 2022
@adrinux
Copy link
Owner Author

adrinux commented Nov 3, 2022

I find this it more readable to add deg to degrees when syntax highlighted in an editor and we can drop the a, just use hsl() like:

--colorname: hsl(190deg 60% 50% / 0.9);

Also make this more modular so we can easily change alpha when using the color in rules. Though it's also more verbose.

--colorname-core: 190deg 60% 50%;
--colorname: hsl(var(--colorname-core) / 1);

Or perhaps by setting a default alpha and changing that as needed.

--alpha: 1;
--colorname: hsl(190deg 60% 50% / var(--alpha);

Need to check css docs, but I think this can then be altered when applying:

div {
  --alpha: 0.75;
  background-color: var(--colorname);
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant