interface ThemeTokens

Returned by readTokens: the tokens of one style in one scheme, read as the kind of value each is.

Methods

value(token: string): string

Returns the resolved value of token, or throws when it isn't set.

color(
token: string,
over?: string
): string

Returns the color of token as #rrggbb. A translucent one is laid over over (another token) first, as it shows on the site; without over it stays rgba(), as a shadow's must.

stops(token: string): string[]

Returns the colors of the gradient token, in order, without positions.

font(token: string): string

Returns the font stack of token, single-quoted for a style attribute. A family the site bundles as "X Variable" is named "X", as a mail client or Google Fonts knows it.

px(token: string): number

Returns the length of token in pixels.

Usage

import { type ThemeTokens } from "api/mail/theme-tokens.ts";