Colors

Color and contrast are used to convey information, highlight content, and communicate intent.

How to Use

There are two different ways to apply a color to a UI element, via design tokens or via CSS helper classes.

Which one to use will depend on the context: since both refer to the same design token values, from the design system perspective there's no difference between the two methods (it's more of a preference for the "consumer" codebase).

To see the full list of available design tokens (CSS variables) and CSS helpers for the colors, look at the showcase of color palettes below.

👉 Notice: at the moment the CSS helpers are available only for "semantic" colors. In the future we may make available helpers for "palette" and "product/branding" colors, but for now for these colors you have to use the design tokens as CSS variables.

Design tokens

You can use the color design tokens directly in your CSS definitions:

.your-selector {
  color: var(--token-color-foreground-primary);
  background: var(--token-color-surface-faint);
  border: (--token-color-border-strong);
  & :hover {
    color: var(--token-color-foreground-high-contrast);
    background: var(--token-color-foreground-action-active);
  }
}

CSS helper classes

You can use one of the predefined "color" CSS helper classes:

...
<div class="hds-foreground-primary hds-surface-faint hds-border-strong">...</div>

To use this classes you have to import the CSS file [products|devdot]/css/helpers/colors.css from the @hashicorp/design-system-tokens package.

👉 Notice: when a "border-color" CSS helper is used on an element a 1px solid border is applied to it: if you need a different border width/style you have to override it.

Semantic Tokens

Foreground

Use for text and icons.

foreground-strong

  • CSS Variable
  • CSS Helper
  • HEX

foreground-primary

  • CSS Variable
  • CSS Helper
  • HEX

foreground-faint

  • CSS Variable
  • CSS Helper
  • HEX

foreground-high-contrast

  • CSS Variable
  • CSS Helper
  • HEX

foreground-disabled

  • CSS Variable
  • CSS Helper
  • HEX

foreground-action

  • CSS Variable
  • CSS Helper
  • HEX

foreground-action-hover

  • CSS Variable
  • CSS Helper
  • HEX

foreground-action-active

  • CSS Variable
  • CSS Helper
  • HEX

foreground-highlight

  • CSS Variable
  • CSS Helper
  • HEX

foreground-highlight-on-surface

  • CSS Variable
  • CSS Helper
  • HEX

foreground-highlight-high-contrast

  • CSS Variable
  • CSS Helper
  • HEX

foreground-success

  • CSS Variable
  • CSS Helper
  • HEX

foreground-success-on-surface

  • CSS Variable
  • CSS Helper
  • HEX

foreground-success-high-contrast

  • CSS Variable
  • CSS Helper
  • HEX

foreground-warning

  • CSS Variable
  • CSS Helper
  • HEX

foreground-warning-on-surface

  • CSS Variable
  • CSS Helper
  • HEX

foreground-warning-high-contrast

  • CSS Variable
  • CSS Helper
  • HEX

foreground-critical

  • CSS Variable
  • CSS Helper
  • HEX

foreground-critical-on-surface

  • CSS Variable
  • CSS Helper
  • HEX

foreground-critical-high-contrast

  • CSS Variable
  • CSS Helper
  • HEX

Surface

Use for container and component backgrounds.

surface-primary

  • CSS Variable
  • CSS Helper
  • HEX

surface-faint

  • CSS Variable
  • CSS Helper
  • HEX

surface-strong

  • CSS Variable
  • CSS Helper
  • HEX

surface-interactive

  • CSS Variable
  • CSS Helper
  • HEX

surface-interactive-hover

  • CSS Variable
  • CSS Helper
  • HEX

surface-interactive-active

  • CSS Variable
  • CSS Helper
  • HEX

surface-interactive-disabled

  • CSS Variable
  • CSS Helper
  • HEX

surface-action

  • CSS Variable
  • CSS Helper
  • HEX

surface-highlight

  • CSS Variable
  • CSS Helper
  • HEX

surface-success

  • CSS Variable
  • CSS Helper
  • HEX

surface-warning

  • CSS Variable
  • CSS Helper
  • HEX

surface-critical

  • CSS Variable
  • CSS Helper
  • HEX

Border

Use for container and component borders. Neutral values can also be used for horizontal rules.

border-primary

  • CSS Variable
  • CSS Helper
  • HEX

border-faint

  • CSS Variable
  • CSS Helper
  • HEX

border-strong

  • CSS Variable
  • CSS Helper
  • HEX

border-action

  • CSS Variable
  • CSS Helper
  • HEX

border-highlight

  • CSS Variable
  • CSS Helper
  • HEX

border-success

  • CSS Variable
  • CSS Helper
  • HEX

border-warning

  • CSS Variable
  • CSS Helper
  • HEX

border-critical

  • CSS Variable
  • CSS Helper
  • HEX

Focus

Use to indicate an element is in a focused state. Critical values for critical actions only, Action values for everything else. Notice: they're used internally by the design system to define focus states.

focus-action

  • CSS Variable
  • CSS Helper
  • HEX

focus-action

  • CSS Variable
  • CSS Helper
  • HEX

focus-critical

  • CSS Variable
  • CSS Helper
  • HEX

focus-critical

  • CSS Variable
  • CSS Helper
  • HEX

Page

Use for page backgrounds.

page-primary

  • CSS Variable
  • CSS Helper
  • HEX

page-faint

  • CSS Variable
  • CSS Helper
  • HEX

Branding Colors

Hashicorp

hashicorp-brand

  • CSS Variable
  • CSS Helper
  • HEX

Boundary

boundary-brand

  • CSS Variable
  • CSS Helper
  • HEX

boundary-foreground

  • CSS Variable
  • CSS Helper
  • HEX

boundary-surface

  • CSS Variable
  • CSS Helper
  • HEX

boundary-border

  • CSS Variable
  • CSS Helper
  • HEX

boundary-gradient

  • CSS Variable
  • CSS Helper
  • HEX

boundary-gradient

  • CSS Variable
  • CSS Helper
  • HEX

boundary-gradient

  • CSS Variable
  • CSS Helper
  • HEX

boundary-gradient

  • CSS Variable
  • CSS Helper
  • HEX

Consul

consul-brand

  • CSS Variable
  • CSS Helper
  • HEX

consul-foreground

  • CSS Variable
  • CSS Helper
  • HEX

consul-surface

  • CSS Variable
  • CSS Helper
  • HEX

consul-border

  • CSS Variable
  • CSS Helper
  • HEX

consul-gradient

  • CSS Variable
  • CSS Helper
  • HEX

consul-gradient

  • CSS Variable
  • CSS Helper
  • HEX

consul-gradient

  • CSS Variable
  • CSS Helper
  • HEX

consul-gradient

  • CSS Variable
  • CSS Helper
  • HEX

Hcp

hcp-brand

  • CSS Variable
  • CSS Helper
  • HEX

Nomad

nomad-brand

  • CSS Variable
  • CSS Helper
  • HEX

nomad-foreground

  • CSS Variable
  • CSS Helper
  • HEX

nomad-surface

  • CSS Variable
  • CSS Helper
  • HEX

nomad-border

  • CSS Variable
  • CSS Helper
  • HEX

nomad-gradient

  • CSS Variable
  • CSS Helper
  • HEX

nomad-gradient

  • CSS Variable
  • CSS Helper
  • HEX

nomad-gradient

  • CSS Variable
  • CSS Helper
  • HEX

nomad-gradient

  • CSS Variable
  • CSS Helper
  • HEX

Packer

packer-brand

  • CSS Variable
  • CSS Helper
  • HEX

packer-foreground

  • CSS Variable
  • CSS Helper
  • HEX

packer-surface

  • CSS Variable
  • CSS Helper
  • HEX

packer-border

  • CSS Variable
  • CSS Helper
  • HEX

packer-gradient

  • CSS Variable
  • CSS Helper
  • HEX

packer-gradient

  • CSS Variable
  • CSS Helper
  • HEX

packer-gradient

  • CSS Variable
  • CSS Helper
  • HEX

packer-gradient

  • CSS Variable
  • CSS Helper
  • HEX

Terraform

terraform-brand

  • CSS Variable
  • CSS Helper
  • HEX

terraform-foreground

  • CSS Variable
  • CSS Helper
  • HEX

terraform-surface

  • CSS Variable
  • CSS Helper
  • HEX

terraform-border

  • CSS Variable
  • CSS Helper
  • HEX

terraform-gradient

  • CSS Variable
  • CSS Helper
  • HEX

terraform-gradient

  • CSS Variable
  • CSS Helper
  • HEX

terraform-gradient

  • CSS Variable
  • CSS Helper
  • HEX

terraform-gradient

  • CSS Variable
  • CSS Helper
  • HEX

Vagrant

vagrant-brand

  • CSS Variable
  • CSS Helper
  • HEX

vagrant-foreground

  • CSS Variable
  • CSS Helper
  • HEX

vagrant-surface

  • CSS Variable
  • CSS Helper
  • HEX

vagrant-border

  • CSS Variable
  • CSS Helper
  • HEX

vagrant-gradient

  • CSS Variable
  • CSS Helper
  • HEX

vagrant-gradient

  • CSS Variable
  • CSS Helper
  • HEX

vagrant-gradient

  • CSS Variable
  • CSS Helper
  • HEX

vagrant-gradient

  • CSS Variable
  • CSS Helper
  • HEX

Vault

vault-brand

  • CSS Variable
  • CSS Helper
  • HEX

vault-brand-alt

  • CSS Variable
  • CSS Helper
  • HEX

vault-foreground

  • CSS Variable
  • CSS Helper
  • HEX

vault-surface

  • CSS Variable
  • CSS Helper
  • HEX

vault-border

  • CSS Variable
  • CSS Helper
  • HEX

vault-gradient

  • CSS Variable
  • CSS Helper
  • HEX

vault-gradient

  • CSS Variable
  • CSS Helper
  • HEX

vault-gradient

  • CSS Variable
  • CSS Helper
  • HEX

vault-gradient

  • CSS Variable
  • CSS Helper
  • HEX

Waypoint

waypoint-brand

  • CSS Variable
  • CSS Helper
  • HEX

waypoint-foreground

  • CSS Variable
  • CSS Helper
  • HEX

waypoint-surface

  • CSS Variable
  • CSS Helper
  • HEX

waypoint-border

  • CSS Variable
  • CSS Helper
  • HEX

waypoint-gradient

  • CSS Variable
  • CSS Helper
  • HEX

waypoint-gradient

  • CSS Variable
  • CSS Helper
  • HEX

waypoint-gradient

  • CSS Variable
  • CSS Helper
  • HEX

waypoint-gradient

  • CSS Variable
  • CSS Helper
  • HEX

Core Palette

Core Palette colors should be used sparingly and only when the correct semantic mapping isn’t available for the use case.

Blue

blue-500

  • CSS Variable
  • CSS Helper
  • HEX

blue-400

  • CSS Variable
  • CSS Helper
  • HEX

blue-300

  • CSS Variable
  • CSS Helper
  • HEX

blue-200

  • CSS Variable
  • CSS Helper
  • HEX

blue-100

  • CSS Variable
  • CSS Helper
  • HEX

blue-50

  • CSS Variable
  • CSS Helper
  • HEX

Purple

purple-500

  • CSS Variable
  • CSS Helper
  • HEX

purple-400

  • CSS Variable
  • CSS Helper
  • HEX

purple-300

  • CSS Variable
  • CSS Helper
  • HEX

purple-200

  • CSS Variable
  • CSS Helper
  • HEX

purple-100

  • CSS Variable
  • CSS Helper
  • HEX

purple-50

  • CSS Variable
  • CSS Helper
  • HEX

Green

green-500

  • CSS Variable
  • CSS Helper
  • HEX

green-400

  • CSS Variable
  • CSS Helper
  • HEX

green-300

  • CSS Variable
  • CSS Helper
  • HEX

green-200

  • CSS Variable
  • CSS Helper
  • HEX

green-100

  • CSS Variable
  • CSS Helper
  • HEX

green-50

  • CSS Variable
  • CSS Helper
  • HEX

Amber

amber-500

  • CSS Variable
  • CSS Helper
  • HEX

amber-400

  • CSS Variable
  • CSS Helper
  • HEX

amber-300

  • CSS Variable
  • CSS Helper
  • HEX

amber-200

  • CSS Variable
  • CSS Helper
  • HEX

amber-100

  • CSS Variable
  • CSS Helper
  • HEX

amber-50

  • CSS Variable
  • CSS Helper
  • HEX

Red

red-500

  • CSS Variable
  • CSS Helper
  • HEX

red-400

  • CSS Variable
  • CSS Helper
  • HEX

red-300

  • CSS Variable
  • CSS Helper
  • HEX

red-200

  • CSS Variable
  • CSS Helper
  • HEX

red-100

  • CSS Variable
  • CSS Helper
  • HEX

red-50

  • CSS Variable
  • CSS Helper
  • HEX

Neutral

neutral-700

  • CSS Variable
  • CSS Helper
  • HEX

neutral-600

  • CSS Variable
  • CSS Helper
  • HEX

neutral-500

  • CSS Variable
  • CSS Helper
  • HEX

neutral-400

  • CSS Variable
  • CSS Helper
  • HEX

neutral-300

  • CSS Variable
  • CSS Helper
  • HEX

neutral-200

  • CSS Variable
  • CSS Helper
  • HEX

neutral-100

  • CSS Variable
  • CSS Helper
  • HEX

neutral-50

  • CSS Variable
  • CSS Helper
  • HEX

neutral-0

  • CSS Variable
  • CSS Helper
  • HEX

Alpha

alpha-300

  • CSS Variable
  • CSS Helper
  • HEX

alpha-200

  • CSS Variable
  • CSS Helper
  • HEX

alpha-100

  • CSS Variable
  • CSS Helper
  • HEX