Mixins / foldkit-mixins/theme

Themes

namespace · packages/mixins/src/theme.ts:71

const Themes = { make, apply }

Themes installed by name: Themes.make({ iris, cobalt }, { initial: 'iris' }), Themes.apply.

In the guides

Members

Themes.make

function · packages/mixins/src/theme/themes.ts:69

make<
  const Record extends {
    readonly [name: string]: KnobTheme<Standard>
  },
>(
  themes: Record,
  options: {
    readonly initial: keyof Record & string
    readonly attribute?: string
  },
): Themes<keyof Record & string>

themes installed by their keys, initial shown until the Model chooses another. A name is a key, so it is unique, and Name is the Schema of the Model field that holds the active one.

Themes.apply

function · packages/mixins/src/theme/themes.ts:96

apply<Name extends string>(
  themes: Themes<Name>,
  name: Name,
): Effect.Effect<void>

Shows name on the root element, as a Command's effect: the initial theme removes the attribute, so the root's own declarations apply.