Skip to content
GitHub

Theme

class in meocord/common Since 4.0.0 Deprecated

Since 4.1, and removed in the next major version (5.0). Use useTheme().colors instead. Themes follow the app, a controller and a server; set the colours in @MeoCord({ theme }): primaryColor is colors.primary, successColor colors.success, infoColor colors.info, errorColor colors.danger and warningColor colors.warning.

class Theme

Five of the theme's colours as static properties: primary, success, info, danger and warning.

Each one reads the matching role of the theme where it is read, useTheme().colors, so code written against it follows @MeoCord({ theme }) and @UseTheme with no change. Assigning one recolours MeoCord's views, as a role beneath every theme an app sets. Reading or assigning each one logs a warning once.

Examples

TypeScript
// Both colour the embed with the call's primary colour; write the second in new code
new EmbedBuilder().setColor(Theme.primaryColor)
new EmbedBuilder().setColor(useTheme().colors.primary)

Members

constructor

new Theme()

errorColor

static get errorColor(): ColorResolvable
static set errorColor(value: ColorResolvable)

infoColor

static get infoColor(): ColorResolvable
static set infoColor(value: ColorResolvable)

primaryColor Since 4.1.0

static get primaryColor(): ColorResolvable
static set primaryColor(value: ColorResolvable)

successColor

static get successColor(): ColorResolvable
static set successColor(value: ColorResolvable)

warningColor

static get warningColor(): ColorResolvable
static set warningColor(value: ColorResolvable)