Urgent.News

What's breaking now, across thousands of outlets.

Tech

Stop writing hex codes in your CSS

The hover state that started it all A design review last Monday morning really got under my skin. Our lead designer noticed a subtle mismatch in a button hover state. I opened the component file to check the code. Right there in the styled component was a hardcoded #3B82F6 . The problem is our primary brand blue changed to #2563EB three months ago. This developer had just copied the hex code…

Last Monday's design review sparked frustration over a subtle button hover issue. A lead designer spotted a hard-coded #3B82F6 hex code in a styled component, despite the primary blue changing to #2563EB three months prior. The developer copied the hex directly from Figma and never updated it, creating technical debt that broke visual consistency.

This scenario is common across codebases worldwide, wasting developer time and causing potential errors. Scaling the issue, introducing dark mode requires separate style blocks for each theme, doubling maintenance burden and making components rigid. For multi-brand products, this process becomes even more cumbersome, with developers having to manage multiple theme configurations.

While some may argue CSS tokens are unnecessary for small projects, the reality is that hardcoding hex values is a costly mistake. Semantic variable names offer a more efficient, adaptable solution that simplifies updates and maintains visual consistency across designs. Tools like Design System Sync can automate the process of syncing design tokens between Figma and code, reducing manual errors and streamlining the development workflow.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How to Make a Favicon for Your Website (Sizes, Formats, and HTML)

A favicon is the small icon in a browser tab, bookmark list, and search result. It is also the icon people see when they add your site to their home screen.

  • Favicon is tiny icon in browser tabs and bookmarks
  • Create favicon.ico, icon.svg, apple-touch-icon.png, icon-192.png, and icon-512.png
  • Add favicon HTML code to site's head for visibility

More from Wednesday 30 September →