Structural vs Interactive Colour — UI/UX

Structural colour (backgrounds, surfaces, borders, plain text) builds the page and uses greys or white. On Mrs. Sri's page these are #f1f5f9, #fff, #e2e8f0…

Open an app you use every day and notice where its brightest colour appears. Almost always only on buttons, links and the active tab. Backgrounds, cards and plain text are left white and grey. That's no accident.

Colour in a UI has two jobs. Structural colour builds the page: backgrounds, card surfaces, borders and plain text. Interactive colour marks what can be pressed: buttons, links, the active choice. Picture an office building. Walls, floors and room doors are painted white and grey, but the lift buttons and the fire alarm lever are a bright colour. If the walls were bright red too, nobody would find the alarm lever when they need it. A web page works the same way: the walls and floors are the structural colour, and the lift buttons and the alarm lever are the interactive colour. A bright colour only works when it's the only one.

Colour's two jobs on Mrs. Sri's page

Structural Interactive
Its job builds the page, invites no action marks what can be pressed
Its colours bluish greys and white green #15803d
On the page background #f1f5f9, card #fff, border #e2e8f0, text #1f2937 and #475569 the book button, the chosen night, the "See the full cancellation rules" link, the focus ring

The rule fits in one sentence: on this page, green is only used for what can be pressed. Once guests learn that green means "press me", they don't have to guess any more.

Name colours by their job

Store colours as CSS variables (their official name is CSS custom properties), and name them by their job, not by their colour. var(--name) uses the colour stored in that variable. In this code, .mist is the card, .price the price, .book the book button and .policy the cancellation rules link:

:root {
  /* structural */
  --surface-page: #f1f5f9;
  --surface-card: #ffffff;
  --border: #e2e8f0;
  --text: #1f2937;
  --text-muted: #475569;
  /* interactive */
  --action: #15803d;
  --action-hover: #166534;
  --action-active: #14532d;
  --on-action: #ffffff;
}

body { color: var(--text); background-color: var(--surface-page); }
.mist { background-color: var(--surface-card); border: 1px solid var(--border); }
.price { color: var(--text); }
.book { color: var(--on-action); background-color: var(--action); }
.book:hover { background-color: var(--action-hover); }
.book:active { background-color: var(--action-active); }
.policy { color: var(--action); text-decoration: underline; }

A disabled state is not the action colour

The book button is disabled until the guest picks a number of nights. A disabled button can't be pressed, so it takes structural colours: background #e2e8f0 with #475569 text. The ratio is 6.15:1, so it is still readable, even though WCAG exempts disabled components from the contrast rule. Don't use a pale green: it still looks like "press me", even though the button can't be pressed. In CSS, :disabled selects a disabled button, and cursor: not-allowed turns the mouse cursor into a "not allowed" sign:

.book:disabled { color: var(--text-muted); background-color: var(--border); cursor: not-allowed; }

The test: green you can't press

Mrs. Sri makes the price "$35 / night" green #15803d so it stands out, the same green as the book button. The price does stand out. Take a guess: what does the "Book the room" button lose? Here is the version of the page with green everywhere. The header band is the coloured strip across the top of the page:

Green element Can be pressed?
Header band "Mist Homestay · Mountain village" No
Price "$35 / night" No
Card border No
"Book the room" button Yes
The chosen night Yes

Three of the five green elements can't be pressed. So the book button loses its special signal. Green stops meaning "can be pressed", because now green also means "important" or "decoration". In the affordance lesson, Mr. Hadi tapped the green date box twice because it looked like a button. A green price invites the same wasted tap. The fix: return the band, the price and the border to structural colours. The price still stands out through font weight and size, not through the action colour.

The exercise: a feature card in blue

In the exercise, you use another card with blue #2563EB as its action colour. The rule is the same, only the colour differs. button selects every button, and a selects every link:

.card { background-color: #F9FAFB; border: 1px solid #E5E7EB; } /* structural */
button { background-color: #2563EB; color: white; }              /* interactive */
a { color: #2563EB; }                                             /* interactive */

⚠️ The action colour in the wrong place

TL;DR: Structural colour (backgrounds, surfaces, borders, plain text) builds the page and uses greys or white. On Mrs. Sri's page these are #f1f5f9, #fff, #e2e8f0, #1f2937 and #475569. Interactive colour marks what can be pressed (buttons, links, the active choice) and is used only there: green #15803d, hover #166534, pressed #14532d. Name colour variables by their job (--action, --surface-card), not by their colour. Disabled buttons (ones that can't be pressed yet) and status labels don't use the interactive colour. In the exercise, the same rule uses blue: card #F9FAFB, button and link #2563EB.

⚡ Colour's two jobs

Meaning: Structural colour builds the page: backgrounds, card surfaces, borders, plain text. Its colours are greys and white. Interactive colour marks what can be pressed: buttons, links, the active choice. On Mrs. Sri's page, green is only used for what can be pressed.

⚡ Name it by its job

Write:

:root {
  --surface-card: #ffffff;
  --text: #1f2937;
  --action: #15803d;
  --action-hover: #166534;
}

.price { color: var(--text); }
.book { background-color: var(--action); }
.book:hover { background-color: var(--action-hover); }

Meaning: Colours are stored as CSS variables, then used with var(). The name says the job, not the colour: --action for the action colour (what can be pressed), not --green. In this code, .book is the book button and .price the price. If Mrs. Sri's brand colour changes, one line changes. If someone writes color: var(--action) on the price, the mistake shows in the name.

⚡ Green you can't press

Guess first: the price is made green #15803d to stand out, the same as the book button. What does the button lose?

Its special signal. Green stops meaning "can be pressed", because now it also means "important". Guests may tap the price for nothing.

Meaning: The price still stands out through font weight and size, not through the action colour. A disabled button, one that can't be pressed yet, uses grey too, not a pale green.

What you will learn