@ovok/native/theme

Theme provider, theme hook, colors and spacing multipliers.

  • Stable unknown
  • Release candidate since 1.16.1-rc.3
  • Development since 1.16.1-dev.2111+9796905

Theme provider, theme hook, colors and spacing multipliers.

Import from @ovok/native/theme.

Components

ThemeProvider()

function ThemeProvider(__namedParameters): Element | null;

Provides the theme, loads the DM Sans fonts and renders nothing until they are ready.

Parameters

ParameterType
__namedParametersThemeProviderProps

Returns

Element | null

Hooks

useAppTheme()

function useAppTheme(): object;

Returns the current AppTheme.

Returns

NameTypeDefault valueDescription
borderRadius()(value) => number-Scales a border radius step to pixels.
borderRadiusScaleRecord<string, number> | undefined-Border radius lookup table, when the theme uses one.
colorsobject-Material 3 colors merged with the app palette and extra colors.
colors.blueIndexedColor-Blue scale.
colors.cyanIndexedColor-Cyan scale.
colors.errorstring-Color for error states.
colors.grayIndexedColor-Neutral gray scale.
colors.greenIndexedColor-Green scale.
colors.orangeIndexedColor-Orange scale.
colors.pinkIndexedColor-Pink scale.
colors.purpleIndexedColor-Purple scale.
colors.redIndexedColor-Red scale.
colors.successstring-Color for success states.
colors.warningstring-Color for warning states.
colors.yellowIndexedColor-Yellow scale.
darkbooleantheme.darkWhether the dark variant is used.
fontsMD3Typescale-Material 3 fonts with the app's font families applied.
roundnessnumber-Base corner roundness taken from the border radius multiplier.
spacing()(value) => number-Scales a spacing step to pixels.
spacingScaleRecord<string, number> | undefined-Spacing lookup table, when the theme uses one.

Interfaces

ThemeFonts

Font families used by the theme.

Properties

PropertyTypeDescription
body?stringFont family for body text.
display?stringFont family for headings.
mono?stringMonospace font family.

ThemeProviderProps

Props for ThemeProvider.

Properties

PropertyTypeDescription
childrenReactNodeApp content that receives the theme.
themeobjectTheme configuration.
theme.borderRadiusMultiplierThemeScaleMultiplier applied to border radius values.
theme.colorsPartial<MD3Colors> & objectColor palette, merged over the Material 3 colors.
theme.darkbooleanWhether the dark variant is used.
theme.extraColors?Record<string, string>Additional named colors available on the theme.
theme.fonts?ThemeFontsFont families.
theme.spacingMultiplierThemeScaleMultiplier applied to spacing values.

Type Aliases

AppTheme

type AppTheme = ReturnType<typeof generateTheme>;

The generated theme: Material 3 theme plus Ovok colors, fonts, spacing and borderRadius helpers.


ThemeScale

type ThemeScale = number | Record<string, number>;

A single multiplier, or a map of named multipliers.

Variables

DEFAULT_COLORS

const DEFAULT_COLORS: Colors;

Default Ovok color palette used when the theme does not override colors.


DEFAULT_MULTIPLIERS

const DEFAULT_MULTIPLIERS: object;

Default spacing and border radius multipliers used when the theme does not set its own.

Type Declaration

NameTypeDefault valueDescription
borderRadius44Pixels per border radius step.
spacing44Pixels per spacing step.

Last updated on

On this page