Navigation

v2.1.0
Materials

Category

Named colors that tell which category a piece of data belongs to.

On this page

A category is which piece of data something belongs to: a project, a calendar, a team, a label. Master UI tells a category by one of the preset's 23 named palettes, through four roles each palette gives: a tinted surface, the text that reads on it, a decorative line and a mark for a dot or a bar. A category-<name> class sets the four roles for itself and for what it holds, and the parts that opt in read them.

Category

<span class="badge badge-category badge-dot category-teal">Design system</span><span class="badge badge-category badge-dot category-violet">Research</span><span class="badge badge-category badge-dot category-orange">Launch</span>
<>  <span className="badge badge-category badge-dot category-teal">Design system</span>  <span className="badge badge-category badge-dot category-violet">Research</span>  <span className="badge badge-category badge-dot category-orange">Launch</span></>
<span class="badge badge-category badge-dot category-teal">Design system</span><span class="badge badge-category badge-dot category-violet">Research</span><span class="badge badge-category badge-dot category-orange">Launch</span>
<template>  <span class="badge badge-category badge-dot category-teal">Design system</span>  <span class="badge badge-category badge-dot category-violet">Research</span>  <span class="badge badge-category badge-dot category-orange">Launch</span></template>

#Chrome, status, category, content

Neutral chrome is the default; status colors say how something is, category colors say what it belongs to, content colors show the data as it is, and the brand color keeps its one moment.

  • Status is a tone of a component, such as badge-success: done, failing, at risk. It always comes with words that say the same.
  • Category is a class around the data, such as category-blue: a project, a calendar, a tag. Red here names a category, never a danger, and a badge is one or the other, never both.
  • Content is a color the data is: a paint, a theme's accent, a chart's series. A swatch shows it as it is.

A button, a field, a dialog or any other chrome inside a category keeps its neutral face: only badge-category, chip-category, schedule-event-category and icon-frame-category read the roles.

#The palettes

Every palette sits at one lightness per role, so no category weighs more than another, and each role clears its contrast in Moonstone, Obsidian and Paper: the text 4.5:1 and the mark 3:1, on its own surface and on the base and raised faces. The hue and the chroma are the palette's own; a yellow's text leans toward amber, as the preset's darker steps do, instead of turning olive.

The palettes

<div class="flex flex-wrap justify-center gap-xs max-w(560)">  <span class="badge badge-category badge-dot category-stone">Stone</span>  <span class="badge badge-category badge-dot category-gray">Gray</span>  <span class="badge badge-category badge-dot category-zinc">Zinc</span>  <span class="badge badge-category badge-dot category-neutral">Neutral</span>  <span class="badge badge-category badge-dot category-slate">Slate</span>  <span class="badge badge-category badge-dot category-brown">Brown</span>  <span class="badge badge-category badge-dot category-orange">Orange</span>  <span class="badge badge-category badge-dot category-amber">Amber</span>  <span class="badge badge-category badge-dot category-yellow">Yellow</span>  <span class="badge badge-category badge-dot category-lime">Lime</span>  <span class="badge badge-category badge-dot category-green">Green</span>  <span class="badge badge-category badge-dot category-beryl">Beryl</span>  <span class="badge badge-category badge-dot category-teal">Teal</span>  <span class="badge badge-category badge-dot category-cyan">Cyan</span>  <span class="badge badge-category badge-dot category-sky">Sky</span>  <span class="badge badge-category badge-dot category-blue">Blue</span>  <span class="badge badge-category badge-dot category-indigo">Indigo</span>  <span class="badge badge-category badge-dot category-violet">Violet</span>  <span class="badge badge-category badge-dot category-purple">Purple</span>  <span class="badge badge-category badge-dot category-fuchsia">Fuchsia</span>  <span class="badge badge-category badge-dot category-pink">Pink</span>  <span class="badge badge-category badge-dot category-crimson">Crimson</span>  <span class="badge badge-category badge-dot category-red">Red</span></div>
<div className="flex flex-wrap justify-center gap-xs max-w(560)">  <span className="badge badge-category badge-dot category-stone">Stone</span>  <span className="badge badge-category badge-dot category-gray">Gray</span>  <span className="badge badge-category badge-dot category-zinc">Zinc</span>  <span className="badge badge-category badge-dot category-neutral">Neutral</span>  <span className="badge badge-category badge-dot category-slate">Slate</span>  <span className="badge badge-category badge-dot category-brown">Brown</span>  <span className="badge badge-category badge-dot category-orange">Orange</span>  <span className="badge badge-category badge-dot category-amber">Amber</span>  <span className="badge badge-category badge-dot category-yellow">Yellow</span>  <span className="badge badge-category badge-dot category-lime">Lime</span>  <span className="badge badge-category badge-dot category-green">Green</span>  <span className="badge badge-category badge-dot category-beryl">Beryl</span>  <span className="badge badge-category badge-dot category-teal">Teal</span>  <span className="badge badge-category badge-dot category-cyan">Cyan</span>  <span className="badge badge-category badge-dot category-sky">Sky</span>  <span className="badge badge-category badge-dot category-blue">Blue</span>  <span className="badge badge-category badge-dot category-indigo">Indigo</span>  <span className="badge badge-category badge-dot category-violet">Violet</span>  <span className="badge badge-category badge-dot category-purple">Purple</span>  <span className="badge badge-category badge-dot category-fuchsia">Fuchsia</span>  <span className="badge badge-category badge-dot category-pink">Pink</span>  <span className="badge badge-category badge-dot category-crimson">Crimson</span>  <span className="badge badge-category badge-dot category-red">Red</span></div>
<div class="flex flex-wrap justify-center gap-xs max-w(560)">  <span class="badge badge-category badge-dot category-stone">Stone</span>  <span class="badge badge-category badge-dot category-gray">Gray</span>  <span class="badge badge-category badge-dot category-zinc">Zinc</span>  <span class="badge badge-category badge-dot category-neutral">Neutral</span>  <span class="badge badge-category badge-dot category-slate">Slate</span>  <span class="badge badge-category badge-dot category-brown">Brown</span>  <span class="badge badge-category badge-dot category-orange">Orange</span>  <span class="badge badge-category badge-dot category-amber">Amber</span>  <span class="badge badge-category badge-dot category-yellow">Yellow</span>  <span class="badge badge-category badge-dot category-lime">Lime</span>  <span class="badge badge-category badge-dot category-green">Green</span>  <span class="badge badge-category badge-dot category-beryl">Beryl</span>  <span class="badge badge-category badge-dot category-teal">Teal</span>  <span class="badge badge-category badge-dot category-cyan">Cyan</span>  <span class="badge badge-category badge-dot category-sky">Sky</span>  <span class="badge badge-category badge-dot category-blue">Blue</span>  <span class="badge badge-category badge-dot category-indigo">Indigo</span>  <span class="badge badge-category badge-dot category-violet">Violet</span>  <span class="badge badge-category badge-dot category-purple">Purple</span>  <span class="badge badge-category badge-dot category-fuchsia">Fuchsia</span>  <span class="badge badge-category badge-dot category-pink">Pink</span>  <span class="badge badge-category badge-dot category-crimson">Crimson</span>  <span class="badge badge-category badge-dot category-red">Red</span></div>
<template>  <div class="flex flex-wrap justify-center gap-xs max-w(560)">    <span class="badge badge-category badge-dot category-stone">Stone</span>    <span class="badge badge-category badge-dot category-gray">Gray</span>    <span class="badge badge-category badge-dot category-zinc">Zinc</span>    <span class="badge badge-category badge-dot category-neutral">Neutral</span>    <span class="badge badge-category badge-dot category-slate">Slate</span>    <span class="badge badge-category badge-dot category-brown">Brown</span>    <span class="badge badge-category badge-dot category-orange">Orange</span>    <span class="badge badge-category badge-dot category-amber">Amber</span>    <span class="badge badge-category badge-dot category-yellow">Yellow</span>    <span class="badge badge-category badge-dot category-lime">Lime</span>    <span class="badge badge-category badge-dot category-green">Green</span>    <span class="badge badge-category badge-dot category-beryl">Beryl</span>    <span class="badge badge-category badge-dot category-teal">Teal</span>    <span class="badge badge-category badge-dot category-cyan">Cyan</span>    <span class="badge badge-category badge-dot category-sky">Sky</span>    <span class="badge badge-category badge-dot category-blue">Blue</span>    <span class="badge badge-category badge-dot category-indigo">Indigo</span>    <span class="badge badge-category badge-dot category-violet">Violet</span>    <span class="badge badge-category badge-dot category-purple">Purple</span>    <span class="badge badge-category badge-dot category-fuchsia">Fuchsia</span>    <span class="badge badge-category badge-dot category-pink">Pink</span>    <span class="badge badge-category badge-dot category-crimson">Crimson</span>    <span class="badge badge-category badge-dot category-red">Red</span>  </div></template>

#One category, named once

Put the class on what belongs to the category, a row, a card or an event, and every part inside that opts in reads it. A part with no category around it falls back to the neutral roles.

One category, named once

<ul class="list max-w(420) w-full">  <li class="list-row category-violet">    <span class="icon-frame icon-frame-sm icon-frame-category list-media" aria-hidden="true">      <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round">        <circle cx="8.75" cy="8.75" r="5.75" /><path d="M12.8159 12.8159L17.5 17.5" />      </svg>    </span>    <span class="list-body">      <span class="list-title">Interview notes</span><span class="list-description">12 files</span>    </span>    <span class="list-end"><span class="badge badge-category">Research</span></span>  </li>  <li class="list-row category-teal">    <span class="icon-frame icon-frame-sm icon-frame-category list-media" aria-hidden="true">      <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round">        <rect x="3" y="3" width="14" height="14" rx="1.25" /><path d="M6.75 10L13.25 10" /><path d="M10 6.75L10 13.25" />      </svg>    </span>    <span class="list-body">      <span class="list-title">Token audit</span><span class="list-description">4 files</span>    </span>    <span class="list-end"><span class="badge badge-category">Design system</span></span>  </li></ul>
import SearchIcon from '@master/icons-react/native/20/soft/search'import SquarePlusIcon from '@master/icons-react/native/20/soft/square-plus'<ul className="list max-w(420) w-full">  <li className="list-row category-violet">    <span className="icon-frame icon-frame-sm icon-frame-category list-media" aria-hidden="true">      <SearchIcon className="icon" />    </span>    <span className="list-body">      <span className="list-title">Interview notes</span><span className="list-description">12 files</span>    </span>    <span className="list-end"><span className="badge badge-category">Research</span></span>  </li>  <li className="list-row category-teal">    <span className="icon-frame icon-frame-sm icon-frame-category list-media" aria-hidden="true">      <SquarePlusIcon className="icon" />    </span>    <span className="list-body">      <span className="list-title">Token audit</span><span className="list-description">4 files</span>    </span>    <span className="list-end"><span className="badge badge-category">Design system</span></span>  </li></ul>
<script>  import SearchIcon from '@master/icons-svelte/native/20/soft/search'  import SquarePlusIcon from '@master/icons-svelte/native/20/soft/square-plus'</script><ul class="list max-w(420) w-full">  <li class="list-row category-violet">    <span class="icon-frame icon-frame-sm icon-frame-category list-media" aria-hidden="true">      <SearchIcon class="icon" />    </span>    <span class="list-body">      <span class="list-title">Interview notes</span><span class="list-description">12 files</span>    </span>    <span class="list-end"><span class="badge badge-category">Research</span></span>  </li>  <li class="list-row category-teal">    <span class="icon-frame icon-frame-sm icon-frame-category list-media" aria-hidden="true">      <SquarePlusIcon class="icon" />    </span>    <span class="list-body">      <span class="list-title">Token audit</span><span class="list-description">4 files</span>    </span>    <span class="list-end"><span class="badge badge-category">Design system</span></span>  </li></ul>
<script setup>import SearchIcon from '@master/icons-vue/native/20/soft/search'import SquarePlusIcon from '@master/icons-vue/native/20/soft/square-plus'</script><template>  <ul class="list max-w(420) w-full">    <li class="list-row category-violet">      <span class="icon-frame icon-frame-sm icon-frame-category list-media" aria-hidden="true">        <SearchIcon class="icon" />      </span>      <span class="list-body">        <span class="list-title">Interview notes</span><span class="list-description">12 files</span>      </span>      <span class="list-end"><span class="badge badge-category">Research</span></span>    </li>    <li class="list-row category-teal">      <span class="icon-frame icon-frame-sm icon-frame-category list-media" aria-hidden="true">        <SquarePlusIcon class="icon" />      </span>      <span class="list-body">        <span class="list-title">Token audit</span><span class="list-description">4 files</span>      </span>      <span class="list-end"><span class="badge badge-category">Design system</span></span>    </li>  </ul></template>

#Tell it in words too

A color is never the only way a category is told. Write its name in the badge or the chip, or beside the dot; a reader who cannot tell teal from green, a printout in grey and a screen reader all need the words. A category color chosen by a user is not a role of the theme and has not been checked for contrast: map it to the nearest named palette, or show it as content, in a swatch.

In forced colors the system colors replace the tints: the words, the edges and a chosen filter keep their system colors, and only a swatch, whose color is its content, keeps its own.

#Retune a palette

The roles are tokens of the theme, --color-category-<name>-surface, -text, -line and -mark, so a theme retunes a palette as it retunes any color: set the four in a theme of its own and keep their contrast. To give a scope a palette of its own, set the four public properties on it.

theme.css
@theme {  --color-category-teal-surface: light-dark(oklch(96% .03 190), oklch(28% .04 190));  --color-category-teal-text: light-dark(oklch(45% .08 190), oklch(87% .09 190));}

#Classes

ClassDescription
category-stoneSets the stone category for this element and what it holds
category-graySets the gray category for this element and what it holds
category-zincSets the zinc category for this element and what it holds
category-neutralSets the neutral category for this element and what it holds
category-slateSets the slate category for this element and what it holds
category-brownSets the brown category for this element and what it holds
category-orangeSets the orange category for this element and what it holds
category-amberSets the amber category for this element and what it holds
category-yellowSets the yellow category for this element and what it holds
category-limeSets the lime category for this element and what it holds
category-greenSets the green category for this element and what it holds
category-berylSets the beryl category for this element and what it holds
category-tealSets the teal category for this element and what it holds
category-cyanSets the cyan category for this element and what it holds
category-skySets the sky category for this element and what it holds
category-blueSets the blue category for this element and what it holds
category-indigoSets the indigo category for this element and what it holds
category-violetSets the violet category for this element and what it holds
category-purpleSets the purple category for this element and what it holds
category-fuchsiaSets the fuchsia category for this element and what it holds
category-pinkSets the pink category for this element and what it holds
category-crimsonSets the crimson category for this element and what it holds
category-redSets the red category for this element and what it holds

#Custom properties

PropertyDefaultDescription
--category-surfaceThe tinted surface of a category part. Set by every category-<name> class; a part without one falls back to its neutral surfaceSet on category-blue
--category-textText on the category surface; 4.5:1 against it and against the base and raised facesSet on category-blue
--category-lineA decorative contour around the category surface; it is never the only edge of a controlSet on category-blue
--category-markA dot or a bar that marks the category; 3:1 against the category surface and the base and raised facesSet on category-blue

#Source

@master/ui/components/category.css
/* * Category: which piece of data something belongs to (a project, a calendar, a label), told by a color. * A category-<name> class draws nothing. It sets the four category roles for itself and for what it holds, so a * row, a card or an event names its category once and every part that opts in reads the same one: * badge-category, chip-category, schedule-event-category, icon-frame-category and a chart's marks. Nothing else * reads them, so a button, a field or a dialog inside a category keeps its neutral chrome. Without a category class those parts * fall back to the neutral roles. * * Color is never the only way a category is told: its name, an icon or a word goes with it. */@layer components.ui {  .category-stone {    --category-surface: var(--color-category-stone-surface);    --category-text: var(--color-category-stone-text);    --category-line: var(--color-category-stone-line);    --category-mark: var(--color-category-stone-mark);  }  .category-gray {    --category-surface: var(--color-category-gray-surface);    --category-text: var(--color-category-gray-text);    --category-line: var(--color-category-gray-line);    --category-mark: var(--color-category-gray-mark);  }  .category-zinc {    --category-surface: var(--color-category-zinc-surface);    --category-text: var(--color-category-zinc-text);    --category-line: var(--color-category-zinc-line);    --category-mark: var(--color-category-zinc-mark);  }  .category-neutral {    --category-surface: var(--color-category-neutral-surface);    --category-text: var(--color-category-neutral-text);    --category-line: var(--color-category-neutral-line);    --category-mark: var(--color-category-neutral-mark);  }  .category-slate {    --category-surface: var(--color-category-slate-surface);    --category-text: var(--color-category-slate-text);    --category-line: var(--color-category-slate-line);    --category-mark: var(--color-category-slate-mark);  }  .category-brown {    --category-surface: var(--color-category-brown-surface);    --category-text: var(--color-category-brown-text);    --category-line: var(--color-category-brown-line);    --category-mark: var(--color-category-brown-mark);  }  .category-orange {    --category-surface: var(--color-category-orange-surface);    --category-text: var(--color-category-orange-text);    --category-line: var(--color-category-orange-line);    --category-mark: var(--color-category-orange-mark);  }  .category-amber {    --category-surface: var(--color-category-amber-surface);    --category-text: var(--color-category-amber-text);    --category-line: var(--color-category-amber-line);    --category-mark: var(--color-category-amber-mark);  }  .category-yellow {    --category-surface: var(--color-category-yellow-surface);    --category-text: var(--color-category-yellow-text);    --category-line: var(--color-category-yellow-line);    --category-mark: var(--color-category-yellow-mark);  }  .category-lime {    --category-surface: var(--color-category-lime-surface);    --category-text: var(--color-category-lime-text);    --category-line: var(--color-category-lime-line);    --category-mark: var(--color-category-lime-mark);  }  .category-green {    --category-surface: var(--color-category-green-surface);    --category-text: var(--color-category-green-text);    --category-line: var(--color-category-green-line);    --category-mark: var(--color-category-green-mark);  }  .category-beryl {    --category-surface: var(--color-category-beryl-surface);    --category-text: var(--color-category-beryl-text);    --category-line: var(--color-category-beryl-line);    --category-mark: var(--color-category-beryl-mark);  }  .category-teal {    --category-surface: var(--color-category-teal-surface);    --category-text: var(--color-category-teal-text);    --category-line: var(--color-category-teal-line);    --category-mark: var(--color-category-teal-mark);  }  .category-cyan {    --category-surface: var(--color-category-cyan-surface);    --category-text: var(--color-category-cyan-text);    --category-line: var(--color-category-cyan-line);    --category-mark: var(--color-category-cyan-mark);  }  .category-sky {    --category-surface: var(--color-category-sky-surface);    --category-text: var(--color-category-sky-text);    --category-line: var(--color-category-sky-line);    --category-mark: var(--color-category-sky-mark);  }  .category-blue {    --category-surface: var(--color-category-blue-surface);    --category-text: var(--color-category-blue-text);    --category-line: var(--color-category-blue-line);    --category-mark: var(--color-category-blue-mark);  }  .category-indigo {    --category-surface: var(--color-category-indigo-surface);    --category-text: var(--color-category-indigo-text);    --category-line: var(--color-category-indigo-line);    --category-mark: var(--color-category-indigo-mark);  }  .category-violet {    --category-surface: var(--color-category-violet-surface);    --category-text: var(--color-category-violet-text);    --category-line: var(--color-category-violet-line);    --category-mark: var(--color-category-violet-mark);  }  .category-purple {    --category-surface: var(--color-category-purple-surface);    --category-text: var(--color-category-purple-text);    --category-line: var(--color-category-purple-line);    --category-mark: var(--color-category-purple-mark);  }  .category-fuchsia {    --category-surface: var(--color-category-fuchsia-surface);    --category-text: var(--color-category-fuchsia-text);    --category-line: var(--color-category-fuchsia-line);    --category-mark: var(--color-category-fuchsia-mark);  }  .category-pink {    --category-surface: var(--color-category-pink-surface);    --category-text: var(--color-category-pink-text);    --category-line: var(--color-category-pink-line);    --category-mark: var(--color-category-pink-mark);  }  .category-crimson {    --category-surface: var(--color-category-crimson-surface);    --category-text: var(--color-category-crimson-text);    --category-line: var(--color-category-crimson-line);    --category-mark: var(--color-category-crimson-mark);  }  .category-red {    --category-surface: var(--color-category-red-surface);    --category-text: var(--color-category-red-text);    --category-line: var(--color-category-red-line);    --category-mark: var(--color-category-red-mark);  }}