Clawscale

Colors

Clawscale colors are semantic tokens with a light and a dark value. Use them instead of raw hex values, so every theme and color scheme works.

Usage#

Use the CSS variable. It switches with the theme and the color scheme.

.run-failed {
  background: var(--cs-color-danger-subtle);
  color: var(--cs-color-danger-text);
}

Where CSS variables do not reach, such as canvas charts, import the values from @clawscale/tokens.

import { dark, light } from "@clawscale/tokens";

light.color["danger-text"]; // "#C22F2F"
dark.color["danger-text"]; // "#FF8585"

These are the default theme's colors. Each swatch shows the light value on the left and the dark value on the right. Tokens lists every color.

Surfaces#

Backgrounds, from the page canvas to raised panels. Hover, active and selected fills are translucent and sit on a surface.

--cs-color-canvasLight#F4F5F7Dark#0F1013
--cs-color-surfaceLight#FFFFFFDark#16171B
--cs-color-surface-raisedLight#FFFFFFDark#1D1F24
--cs-color-surface-sunkenLight#F6F7F9Dark#121316
--cs-color-surface-hoverLightrgba(20, 24, 31, 0.05)Darkrgba(255, 255, 255, 0.06)
--cs-color-surface-activeLightrgba(20, 24, 31, 0.09)Darkrgba(255, 255, 255, 0.10)
--cs-color-surface-selectedLightrgba(53, 99, 233, 0.10)Darkrgba(99, 136, 255, 0.18)

Borders#

border separates regions. border-strong adds emphasis. border-subtle divides rows in tables and lists.

--cs-color-borderLight#E3E6EADark#2A2D33
--cs-color-border-strongLight#CDD2D9Dark#3A3E46
--cs-color-border-subtleLight#ECEEF1Dark#212328

Text#

text-muted and text-subtle pass WCAG AA on every surface. Use text-disabled only for disabled controls.

--cs-color-textLight#1A1C21Dark#E7E9EC
--cs-color-text-mutedLight#555D6ADark#A3AAB4
--cs-color-text-subtleLight#666F7CDark#858D99
--cs-color-text-disabledLight#9AA1ACDark#5E6570
--cs-color-text-inverseLight#FFFFFFDark#0F1013

Intents#

Each intent has a solid fill, a -subtle fill for tinted backgrounds and a -text color that stays readable on surfaces and on the subtle fill. Text on the solid fill uses the -on token.

--cs-color-primaryLight#3563E9Dark#3563E9
--cs-color-primary-subtleLight#EEF3FFDarkrgba(92, 130, 255, 0.16)
--cs-color-primary-textLight#2B55D6Dark#8AA8FF
--cs-color-successLight#1B7F4EDark#1B7F4E
--cs-color-success-subtleLight#E9F6EFDarkrgba(46, 184, 120, 0.15)
--cs-color-success-textLight#17744ADark#4CC38A
--cs-color-warningLight#F5A524Dark#F5A524
--cs-color-warning-subtleLight#FEF6E5Darkrgba(245, 165, 36, 0.14)
--cs-color-warning-textLight#9A5A00Dark#F5B54A
--cs-color-dangerLight#D23535Dark#D23535
--cs-color-danger-subtleLight#FDEEEEDarkrgba(255, 99, 99, 0.14)
--cs-color-danger-textLight#B42A2ADark#FF8585

Chart palette#

Eight categorical colors for chart series, --cs-chart-1 to --cs-chart-8. Their order is validated for color vision deficiency: neighboring slots stay distinct.

  • Assign slots in order: the first series gets slot 1.
  • Never reorder, skip or cycle the slots.
  • With more than eight series, group the smallest into one.
--cs-chart-1Light#3563E9Dark#4A74F0
--cs-chart-2Light#EB6834Dark#D95926
--cs-chart-3Light#1BAF7ADark#199E70
--cs-chart-4Light#EDA100Dark#C98500
--cs-chart-5Light#E87BA4Dark#D55181
--cs-chart-6Light#008300Dark#008300
--cs-chart-7Light#4A3AA7Dark#9085E9
--cs-chart-8Light#E34948Dark#E66767

Chart libraries that take an array can use chartPalettes. It holds each theme's eight colors, in order.

import { useTheme } from "@clawscale/react";
import { type BuiltInThemeName, chartPalettes } from "@clawscale/tokens";

const { theme, resolvedColorScheme } = useTheme();
const colors = (chartPalettes[theme as BuiltInThemeName] ?? chartPalettes.default)[resolvedColorScheme];

For status in charts, use --cs-chart-good, --cs-chart-warning, --cs-chart-serious and --cs-chart-critical, always with an icon and a label. For magnitude, such as heatmaps, use the sequential ramp --cs-chart-seq-100 to --cs-chart-seq-700. See Tokens.