concrete/style/no-hard-coded-color
Colors come from the theme, not from a hex value or a color function in a class or inline style.
Colors come from the theme, not from a hex value or a color function in a class or inline style.
Graded by the lint stage of concrete check, in the lint (warning) venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
A template's palette lives in the @theme block of its stylesheet, and that is what makes
styling a system rather than a pile of values: one place decides the
colours, and every section inherits a change to it. A hex value baked into a class or a
style prop opts that element out — it survives every retheme, drifts from the tokens
around it, and is invisible to anyone reading the theme to find out what the template
uses.
Fix
Use a colour utility from your theme. If the value has no token yet, add one to the
@theme block (--color-brand: …;) and use the bg-brand / text-brand utility it
yields. A color-mix() over theme variables is fine — only a hard-coded argument makes it
a violation. This rule is reported as a warning: it shows in your editor and never fails
concrete check.
Before and after
import { Section, section, Slot, text } from "@homepages/concrete";
export const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
({ slot }) => (
<Section className="bg-[#0f172a] text-[#f8fafc]">
<Slot.Text slot={slot.headline} as="h1" />
</Section>
),
);import { Section, section, Slot, text } from "@homepages/concrete";
// globals.css: @theme { --color-ink: oklch(0.21 0.03 265); --color-paper: oklch(0.98 0 0); }
export const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
({ slot }) => (
<Section className="bg-ink text-paper">
<Slot.Text slot={slot.headline} as="h1" />
</Section>
),
);