This is the web platform
This is the web platform
I love the web. The web should allow anyone to access any experience that they need without the need for native install or content walled garden.
This is the web platform
I wanted a traffic light system on iwanttouse.com to visually represent feature support. Initially, I used simple CSS classes like .good
(green), .ok
(amber), and .bad
(red), but this required clunky conditional logic to handle the color transitions based on percentage support. Paul Lewis suggested using HSL which allows for smooth transitions between red, amber, and green by adjusting the Hue value (0-359). Now, I can dynamically set the color using element.styles.color = \"hsla(\" + ((percentage / 100) * 90) + \", 50%, 50%)\";
which maps the percentage support to a Hue value between 0 (red) and 90 (green).