Menu

Stop your AI hard-coding hex colours. Give it your design tokens over MCP
📰

Stop your AI hard-coding hex colours. Give it your design tokens over MCP

DEV Community: css·Oussema Ajmi·about 8 hours ago
#4KMvTisO
#devtocss#devto#dev#value#type
Long article (2202 words) — no AI summary yet.
Reading 0:00
15s threshold

Ask an AI coding tool for a button in your app and you will often get this:

.save { background : #3b82f6 ; color : #fff ; padding : 10px 16px ; border-radius : 8px ; }

Enter fullscreen mode

Exit fullscreen mode

It renders, and it looks close. But your brand blue is #2f6fed , your spacing scale has no 10px step, your buttons use a 6px radius, and none of it points at a token. The next time someone changes the accent colour or adds a dark theme, this button stays behind.

The model didn't pick #3b82f6 for any reason specific to you. It's one of the most common blues in public code, so it is the model's most likely guess. It has never seen your token file.

In an earlier post I put a component library's props behind a small MCP server so the assistant stops inventing them.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.