2022-11-16
1244
#css
Samuel Martins
131269
Nov 16, 2022 â‹… 4 min read

How to add dynamic colors with CSS

Samuel Martins I am a full-stack developer who loves sharing the knowledge accumulated over the years with people. The different technologies that I have encountered through my journey allows me to relate to beginners and seniors alike. I write about all things tech.

Recent posts:

Implementing Infinite Scroll In Next Js With Server Actions

Implementing infinite scroll in Next.js with Server Actions

Infinite scrolling in Next.js no longer requires external libraries — Server Actions let us fetch initial data directly on the server.

Rahul Chhodde
Apr 19, 2024 â‹… 10 min read
Integrating Django Templates With React For Dynamic Webpages

Integrating Django templates with React for dynamic webpages

Create a dynamic demo blog site using Django and React to demonstrate Django’s server-side functionalities and React’s interactive UI.

Kayode Adeniyi
Apr 18, 2024 â‹… 7 min read
Using Aoi Js To Build A Bot For Discord

Using aoi.js to build a bot on Discord

Explore how the aoi.js library makes it easy to create Discord bots with useful functionalities for frontend applications.

Rahul Padalkar
Apr 17, 2024 â‹… 9 min read
Web Components Adoption Guide: Overview, Examples, And Alternatives

Web Components adoption guide: Overview, examples, and alternatives

Evaluate Web Components, a set of standards that allow you to create custom HTML tags for more reusable, manageable code.

Elijah Asaolu
Apr 16, 2024 â‹… 11 min read
View all posts

3 Replies to "How to add dynamic colors with CSS"

  1. I feel like some context is missing from the article. Where does the keyword `from` come from? This doesn’t seem to work, and I can’t find any reference to it in the CSS specs.

    `–color: hsl(from var(–color) h calc(s – 10%) l);`

  2. I’m pretty sure it has only been implemented on Safari as of right now. I’m not sure of the progress being made on Chrome, FireFox, etc. This appears to come from the Color Level 5 spec which is still in early development. Chrome has just released Color Level 4 and Color-Mix() from the Level 5 spec on Chrome 111, but I cannot find any status update on the remainder of Color Level 5. It appears they are still in the very early stages of development and implementation. I haven’t found any mentions of this on the roadmaps for at least the next few releases of Chrome.

  3. Samual, great article! Thanks.

    I was just about to say the same thing as @EdCharbeneau pointed out. Checking MDN first, I couldn’t find anything about relative colors.

    With Adam’s comment I then found high level browser status for color module 5 on w3.org https://www.w3.org/TR/css-color-5/

    and then the more specific tests for relative-color:
    https://wpt.fyi/results/css/css-color/parsing/color-valid-relative-color.html

    I think it would be good if it were mentioned up in the article section as long as browser support is so sparse.

Leave a Reply