@aesthetic/system
Version:
Web based building blocks for the Aesthetic design system.
43 lines • 1.52 kB
TypeScript
import { ColorScheme, ContrastLevel, ThemeName } from '@aesthetic/types';
import { Theme } from './Theme';
import { ThemeOptions } from './types';
export declare class ThemeRegistry<Block extends object> {
protected darkTheme: string;
protected defaultTheme: string;
protected lightTheme: string;
protected themes: Record<string, Theme<Block>>;
/**
* Return the default dark theme.
*/
getDarkTheme(): Theme<Block>;
/**
* Return the default light theme.
*/
getLightTheme(): Theme<Block>;
/**
* Find an approprite theme based on the user's or device's preferences.
* Will check for preferred color schemes and contrast levels.
*/
getPreferredTheme({ matchColorScheme, matchContrastLevel, }?: {
matchColorScheme?: (scheme: ColorScheme) => boolean;
matchContrastLevel?: (level: ContrastLevel) => boolean;
}): Theme<Block>;
/**
* Return a theme by name or throw an error if not found.
*/
getTheme(name: ThemeName): Theme<Block>;
/**
* Query for a theme that matches the defined parameters.
*/
query(params: Partial<ThemeOptions>): Theme<Block> | undefined;
/**
* Register a theme with a unique name. Can optionally mark a theme
* as default for their defined color scheme.
*/
register(name: string, theme: Theme<Block>, isDefault?: boolean): this;
/**
* Reset the registry to initial state.
*/
reset(): void;
}
//# sourceMappingURL=ThemeRegistry.d.ts.map