Info:
This is release candidate documentation for Stream Chat React SDK v15. For the latest stable version, see the latest version (v14).

Palette variables

The palette is the SDK's set of raw colors: ten color scales, plus black, white and a few transparent values. Most colors in the UI come from it in two steps. For example, in the light theme the primary button is --str-chat__accent-primary, which points at --str-chat__brand-500, which points at --str-chat__blue-500, #005fff.

Change a palette variable to adjust one shade everywhere the themes use it. To change which color a part of the UI uses, for example to give the accent a different hue, change a global variable instead.

How the themes use the palette

Most global variables don't point at the color scales directly. They point at two scales in between:

  • The brand scale, --str-chat__brand-*, carries the brand hue. It's the blue scale in both themes, in reverse order in the dark theme.
  • The chrome scale, --str-chat__chrome-*, carries the neutrals for text, backgrounds and borders. It's the slate scale in the light theme and the neutral scale, reversed, in the dark theme.

This is how the dark theme flips. --str-chat__text-primary points at --str-chat__chrome-900 in both themes. In the light theme --str-chat__chrome-900 is --str-chat__slate-900, #1a1b25. In the dark theme it's --str-chat__neutral-50, #f8f8f8.

The default themes use the blue, slate and neutral scales, mostly through these two; the avatar colors point at blue directly. The success, error and highlight colors point straight at a few shades of green, red and yellow. Cyan, purple, violet and lime aren't used by default. They're there for your own overrides.

Overriding a palette variable

Set the new shade on .str-chat, in a CSS layer after the SDK's:

@layer stream, stream-overrides;
@import "stream-chat-react/dist/css/index.css" layer(stream);

@layer stream-overrides {
  .str-chat {
    --str-chat__blue-500: #0b57d0;
  }
}

In the light theme the accent, links and the read status take the new shade, because they resolve to --str-chat__blue-500. The dark theme's accent is --str-chat__blue-400, so it doesn't change there. In the dark theme --str-chat__blue-500 is --str-chat__brand-300, which colors the borders inside the user's own messages.

Two things to know:

  • Put overrides on .str-chat. The SDK declares every palette variable on .str-chat, so a value set on :root or on a wrapper element never reaches the UI.
  • One override applies to both themes. The palette doesn't change with the theme; the brand and chrome scales pick different shades from it. Check both themes after a change.

Color scales

Each variable is the scale name and a shade, for example --str-chat__green-300. The table lists the value of every shade.

Scale 50 100 150 200 300 400 500 600 700 800 900
--str-chat__slate-* #f6f8fa #ebeef1 #d5dbe1 #c0c8d2 #a3acba #87909f #687385 #545969 #414552 #30313d #1a1b25
--str-chat__neutral-* #f8f8f8 #efefef #d8d8d8 #c4c4c4 #ababab #8f8f8f #6a6a6a #565656 #464646 #323232 #1c1c1c
--str-chat__blue-* #f3f7ff #e3edff #c3d9ff #a5c5ff #78a8ff #4586ff #005fff #1b53bd #19418d #142f63 #091a3b
--str-chat__cyan-* #f1fbfc #d1f3f6 #a9e4ea #72d7e0 #45bcc7 #1e9ea9 #248088 #006970 #065056 #003a3f #002124
--str-chat__green-* #e1ffee #bdfcdb #8febbd #59dea3 #00c384 #00a46e #277e59 #006643 #004f33 #003a25 #002213
--str-chat__purple-* #f7f8ff #ecedff #d4d7ff #c1c5ff #a1a3ff #8482fc #644af9 #553bd8 #4032a1 #2e2576 #1a114d
--str-chat__yellow-* #fef9da #fcedb9 #fcd579 #f6bf57 #fa922b #f26d10 #c84801 #a82c00 #842106 #5f1a05 #331302
--str-chat__red-* #fff5fa #ffe7f2 #ffccdf #ffb1cd #fe87a1 #fc526a #d90d10 #b3093c #890d37 #68052b #3e021a
--str-chat__violet-* #fef4ff #fbe8fe #f7cffc #eeb5f4 #e68bec #d75fe7 #b716ca #9d00ae #7c0089 #5c0066 #36003d
--str-chat__lime-* #f1fde8 #d4ffb0 #b1ee79 #9cda5d #78c100 #639e11 #4b7a0a #3e6213 #355315 #203a00 #112100

Base colors

Variable Value
--str-chat__base-white #ffffff
--str-chat__base-black #000000
--str-chat__base-transparent-0 rgba(255, 255, 255, 0)
--str-chat__base-transparent-white-10 rgba(255, 255, 255, 0.1)
--str-chat__base-transparent-white-20 rgba(255, 255, 255, 0.2)
--str-chat__base-transparent-white-30 rgba(255, 255, 255, 0.3)
--str-chat__base-transparent-white-70 rgba(255, 255, 255, 0.7)
--str-chat__base-transparent-black-5 rgba(0, 0, 0, 0.05)
--str-chat__base-transparent-black-10 rgba(0, 0, 0, 0.1)
--str-chat__base-transparent-black-70 rgba(0, 0, 0, 0.7)

Brand scale

The accent, links, the focus ring and the user's own message bubbles point at this scale. In the dark theme the scale runs in reverse, except --str-chat__brand-400, which keeps its light value.

Variable Light Dark
--str-chat__brand-50 --str-chat__blue-50 (#f3f7ff) --str-chat__blue-900 (#091a3b)
--str-chat__brand-100 --str-chat__blue-100 (#e3edff) --str-chat__blue-800 (#142f63)
--str-chat__brand-150 --str-chat__blue-150 (#c3d9ff) --str-chat__blue-700 (#19418d)
--str-chat__brand-200 --str-chat__blue-200 (#a5c5ff) --str-chat__blue-600 (#1b53bd)
--str-chat__brand-300 --str-chat__blue-300 (#78a8ff) --str-chat__blue-500 (#005fff)
--str-chat__brand-400 --str-chat__blue-400 (#4586ff) --str-chat__blue-400 (#4586ff)
--str-chat__brand-500 --str-chat__blue-500 (#005fff) --str-chat__blue-300 (#78a8ff)
--str-chat__brand-600 --str-chat__blue-600 (#1b53bd) --str-chat__blue-200 (#a5c5ff)
--str-chat__brand-700 --str-chat__blue-700 (#19418d) --str-chat__blue-150 (#c3d9ff)
--str-chat__brand-800 --str-chat__blue-800 (#142f63) --str-chat__blue-100 (#e3edff)
--str-chat__brand-900 --str-chat__blue-900 (#091a3b) --str-chat__blue-50 (#f3f7ff)

Chrome scale

Text, backgrounds and borders point at this scale.

Variable Light Dark
--str-chat__chrome-0 --str-chat__base-white (#ffffff) --str-chat__base-black (#000000)
--str-chat__chrome-50 --str-chat__slate-50 (#f6f8fa) --str-chat__neutral-900 (#1c1c1c)
--str-chat__chrome-100 --str-chat__slate-100 (#ebeef1) --str-chat__neutral-800 (#323232)
--str-chat__chrome-150 --str-chat__slate-150 (#d5dbe1) --str-chat__neutral-700 (#464646)
--str-chat__chrome-200 --str-chat__slate-200 (#c0c8d2) --str-chat__neutral-600 (#565656)
--str-chat__chrome-300 --str-chat__slate-300 (#a3acba) --str-chat__neutral-500 (#6a6a6a)
--str-chat__chrome-400 --str-chat__slate-400 (#87909f) --str-chat__neutral-400 (#8f8f8f)
--str-chat__chrome-500 --str-chat__slate-500 (#687385) --str-chat__neutral-300 (#ababab)
--str-chat__chrome-600 --str-chat__slate-600 (#545969) --str-chat__neutral-200 (#c4c4c4)
--str-chat__chrome-700 --str-chat__slate-700 (#414552) --str-chat__neutral-150 (#d8d8d8)
--str-chat__chrome-800 --str-chat__slate-800 (#30313d) --str-chat__neutral-100 (#efefef)
--str-chat__chrome-900 --str-chat__slate-900 (#1a1b25) --str-chat__neutral-50 (#f8f8f8)
--str-chat__chrome-1000 --str-chat__base-black (#000000) --str-chat__base-white (#ffffff)

Best Practices

  • Use palette variables to adjust a shade. Use global variables to change which color a part of the UI uses.
  • Set overrides on .str-chat, in a layer after the SDK's stylesheet. See Theming for the layer setup.
  • A shade can play different roles in the two themes, so check light and dark after every change.
  • Keep palette overrides few, and re-check contrast where a shade is used for text.
  • Reference palette variables in your own CSS instead of hard-coded colors, so your UI follows the same shades.

The palette and the light theme are generated into light.scss, and the dark theme's changes into dark.scss.