logo

Theming

Themes

gooey ships three themes: vanilla (the default), flat, and scout. Pick one with the theme option, or switch at any time by setting gooey.theme.
const gooey = new Gooey({ theme: 'scout' })

// switch it live
gooey.theme = 'flat'
Every panel also carries a theme picker of its own: open the settings (the gear in its header) and look in the ui folder. This site follows its panels' themes, which is why the page recolors with them.

Mode

Each theme has a dark and a light variant. The themeMode option picks one ('dark' by default), and 'system' follows the visitor's prefers-color-scheme, live.
const gooey = new Gooey({ themeMode: 'system' })

gooey.themer.mode.set('light')

gooey.themer.mode.subscribe(mode => console.log(mode))
This site keeps its own light / dark switch in step with the panels' modes, which is why the whole page follows.

CSS Variables

A theme is a TypeScript object of CSS custom properties. Colors are a short palette: theme-a is the accent, dark-a..e and light-a..e are shades, and each mode derives its background (bg-a..e) and foreground (fg-a..e) from them. Every other variable nests by name, and scout overrides a few:
{
  title: 'scout',
  prefix: 'gooey',
  vars: {
    color: {
      base: {
        'theme-a': '#ff4221',
        'dark-a': '#15161d',
        'light-a': '#dfe1e9',
        // ...theme-b, theme-c, dark-b..e, light-b..e
      },
      dark: {},
      light: {},
    },
    utility: {
      dark: {
        filter: 'contrast(1.05) brightness(1.05)',
      },
    },
    core: {
      dark: {
        'folder-header_background':
          'color-mix(in sRGB, var(--gooey-bg-a) 100%, transparent)',
      },
      light: {
        'controller-dim_background': '#96a09c',
      },
    },
  },
}
The themer writes them onto the panel's wrapper as --gooey-* properties, choosing the base values plus the active mode's. Nested keys join with - and the last one with _, so { folder: { header: { color } } } becomes --gooey-folder-header_color. Switch the theme below and watch the values change:
const vars = ['--gooey-theme-a', '--gooey-bg-a']
const { style } = gooey.wrapper

const show = () => {
  for (const name of vars) {
    console.log(name, style.getPropertyValue(name))
  }
}
gooey.themer.theme.subscribe(show)
gooey.themer.mode.subscribe(show)
The variables land on the wrapper, so a rule of your own on .gooey-root shadows them, and survives every theme and mode change:
.gooey-root {
  --gooey-theme-a: hotpink;
  --gooey-radius-sm: 0;
}
A variable built from another, like folder-header_color (var(--gooey-fg-c)), is resolved on the wrapper, so shadow the variable a rule reads rather than the palette color under it.

Theme Editor

ThemeEditor opens a second gooey that edits the active theme, with a folder of inputs per variable group (color, utility, core), each split by mode. Edits preview live on the panel. save stores the theme as one of the themer's user themes, and saving a built-in theme stores an edited copy beside it, so the original is never overwritten.
import { Gooey, ThemeEditor } from 'gooey'

const gooey = new Gooey({
  position: 'bottom-left',
})

const editor = new ThemeEditor(gooey)
Open color › base in the editor and change theme-a: the panel beside it recolors as you drag. User themes persist in localStorage when the panel has storage on.