Menu
CoddyTech

Theme Color Tokens

Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 46 of 55.

In Tailwind 4, @theme { --color-ink: #112233; } creates color utilities such as bg-ink and text-ink. An ink background computes to RGB 17, 34, 51. The color namespace tells Tailwind which utilities to generate.

<div class="bg-ink">Museum sample</div>
@theme {
  --color-ink: #112233;
  --color-paper: #eeeeee;
  --color-sea: #006677;
  --color-sun: #ffcc00;
}

Define theme variables at the top level of the local stylesheet after the Tailwind import. A normal custom property in a selector can hold a value, but it does not by itself define a new named Tailwind color utility.

challenge icon

Challenge

Medium

Define a theme color named accent with hexadecimal value #335577, and use it for the booking panel background.

Keep the supplied content and element IDs. Edit the HTML utility classes or the requested CSS. Click Run preview to refresh the preview after edits, then use Check/Run code to grade your work.

Try it yourself

<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Practice studio</title><link rel="stylesheet" href="./styles.css"></head><body>
<div id="target" class="">Booking panel</div>
</body></html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals