Skip to main content

Theme

OBR.theme

The theme API gives you access to the current theme used by Owlbear Rodeo.

Reference

Methods

getTheme

async getTheme()

Get the current Owlbear Rodeo theme.

Returns a Theme object.


onChange

onChange(callback);

Parameters

NAMETYPEDESCRIPTION
callback(theme: Theme) => voidA callback for when the current theme changes

Returns a function that when called will unsubscribe from change events.

Example

/**
* Use an `onChange` event with a React `useEffect`.
* `onChange` returns an unsubscribe event to make this easy.
*/
useEffect(
() =>
OBR.theme.onChange((theme) => {
// React to theme changes
}),
[]
);

Type Definitions

Theme

The palette of a theme

TYPE
object

Properties

NAMETYPEDESCRIPTION
mode"DARK" | "LIGHT"The color mode of the theme
primaryThemeColorThe primary color of the theme
secondaryThemeColorThe secondary color of the theme
backgroundThemeBackgroundThe background color of the theme
textThemeTextThe text color of the theme

ThemeColor

TYPE
object

Properties

NAMETYPEDESCRIPTION
mainstringThe main color
lightstringA lightened version of the main color
darkstringA darkened version of the main color
contrastTextstringA text color that contrasts with the main color

ThemeBackground

TYPE
object

Properties

NAMETYPEDESCRIPTION
defaultstringThe base background color
paperstringA highlight background color used for raised background elements

ThemeText

TYPE
object

Properties

NAMETYPEDESCRIPTION
primarystringThe primary text color
secondarystringA secondary text color that recedes compared to the primary text
disabledstringA disabled text color used for disabled elements