matrix-react-sdk
Version:
SDK for matrix.org using React
58 lines (57 loc) • 1.85 kB
TypeScript
export declare const DEFAULT_THEME = "light";
interface IFontFaces extends Omit<Record<(typeof allowedFontFaceProps)[number], string>, "src"> {
src: {
format: string;
url: string;
local: string;
}[];
}
interface CompoundTheme {
[token: string]: string;
}
export type CustomTheme = {
name: string;
is_dark?: boolean;
colors?: {
[key: string]: string;
};
fonts?: {
faces: IFontFaces[];
general: string;
monospace: string;
};
compound?: CompoundTheme;
};
/**
* Given a non-high-contrast theme, find the corresponding high-contrast one
* if it exists, or return undefined if not.
*/
export declare function findHighContrastTheme(theme: string): string | undefined;
/**
* Given a high-contrast theme, find the corresponding non-high-contrast one
* if it exists, or return undefined if not.
*/
export declare function findNonHighContrastTheme(hcTheme: string): string | undefined;
/**
* Decide whether the supplied theme is high contrast.
*/
export declare function isHighContrastTheme(theme: string): boolean;
export declare function enumerateThemes(): {
[key: string]: string;
};
export interface ITheme {
id: string;
name: string;
}
export declare function getOrderedThemes(): ITheme[];
declare const allowedFontFaceProps: readonly ["font-display", "font-family", "font-stretch", "font-style", "font-weight", "font-variant", "font-feature-settings", "font-variation-settings", "src", "unicode-range"];
export declare function getCustomTheme(themeName: string): CustomTheme;
/**
* Called whenever someone changes the theme
* Async function that returns once the theme has been set
* (ie. the CSS has been loaded)
*
* @param {string} theme new theme
*/
export declare function setTheme(theme?: string): Promise<void>;
export {};