reelcn
GitHubBack to landing

Theming

One ThemeProvider restyles colors, fonts, radius and motion for everything inside it.

Every reelcn component reads its colors, fonts, corner radius and default motion from a theme. Wrap a scene once and everything inside restyles:

import { Center, Stage, ThemeProvider } from "./reelcn/core";
import { TextReveal } from "./reelcn/text-reveal";

<ThemeProvider theme="ledger">
  <Stage>
    <Center>
      <TextReveal text="Hello" />
    </Center>
  </Stage>
</ThemeProvider>;

theme takes a preset name or a Theme object. Without a <ThemeProvider>, components use daylight.

Presets

PresetBackgroundAccentHighlightHeading fontWeightRadiusMotion
daylight#EEF0F2#2F5BFF#FFD23FSchibsted Grotesk70014settle
midnight#0B0E14#5F5BFF#4FD1FFSpace Grotesk60010snappy
mono#F5F3EE#C0470A#FFD166Archivo8004snappy
ledger#F7F1E8#B5502E#7C8A5EFraunces60014gentle
afterglow#F1EEFB#7555FA#FF8FB1Sora60020smooth
chromewave#E9EAF0#C4147A#35E0FFUnbounded70018bouncy

neon, paper and sunset still work. They render as chromewave, ledger and midnight.

Every color a component uses — including ones not in this table, like surface, foreground, muted and border — comes from the same Theme.colors object. Read the whole shape with useTheme():

import { useTheme } from "./reelcn/core";

function Badge() {
  const theme = useTheme();
  return <div style={{ background: theme.colors.surface, color: theme.colors.accent }}>New</div>;
}

Building a brand kit

createTheme starts from a preset and overrides only what you name; colors and fonts merge shallowly, so the rest of the preset stays intact:

import { createTheme, ThemeProvider } from "./reelcn/core";

const brand = createTheme("midnight", { colors: { accent: "#ff5a1f" }, radius: 12 });

<ThemeProvider theme={brand}>{/* … */}</ThemeProvider>;

Every component also takes its own color props, so a single instance can break from the theme without a new one.

Opacity

alpha(color, amount) returns any CSS color at amount opacity (0–1), via color-mix:

import { alpha, useTheme } from "./reelcn/core";

const theme = useTheme();
const glass = alpha(theme.colors.surface, 0.6);

Next steps

On this page