Designing an Autogenerated Live Color Scale in CSS
Tipsad 2026-06-04 på Anders Ytterströms webblogg
Generera färgskalor till formhandböcker i realtid med endast CSS
Ännu ett användningsområde för JavaScript ut med badvattnet.
[...] The ability to choose a single “brand” color and then get an entire scale generated based on that color. All of the various components and layouts would then adopt the color scheme by default, simply based off of one --wll-brand-color CSS variable.
Until fairly recently, there was no way to do this live using vanilla CSS!
However, now that we have real CSS functions calculating color math in real-time, we have the ability to guide the user in setting a single color in their stylesheet—and everything else will come along for the ride.
Detta är guld värt för alla webbutvecklare som inkluderar stilguider i sin leverans och i sitt arbetsflöde!