UNPKG

@lithiumjs/ngx-material-theming

Version:

Dynamic and customizable Angular Material theming made easy.

72 lines (71 loc) 2.65 kB
export type PaletteOffset = keyof ThemeCreator.PaletteBase; /** * @param name The name that will be used to reference the new theme. * @param templateData The CSS theme template that will be used to create the final theme data. * @param primaryPalette The primary color palette. * @param accentPalette The accent color palette. * @param warnPalette The warn color palette. */ export interface TemplateThemeCreationOptions { name: string; templateData: string; primaryPalette: ThemeCreator.Palette; accentPalette: ThemeCreator.Palette; warnPalette: ThemeCreator.Palette; templateOptions?: Partial<ThemeTemplateOptions>; } export interface ThemeTemplateOptions { nameMatcher: string | RegExp; primaryHexMatcher: string | RegExp; primaryRgbaMatcher: string | RegExp; accentHexMatcher: string | RegExp; accentRgbaMatcher: string | RegExp; warnHexMatcher: string | RegExp; warnRgbaMatcher: string | RegExp; primaryContrastHexMatcher: string | RegExp; primaryContrastRgbaMatcher: string | RegExp; accentContrastHexMatcher: string | RegExp; accentContrastRgbaMatcher: string | RegExp; warnContrastHexMatcher: string | RegExp; warnContrastRgbaMatcher: string | RegExp; } export declare namespace ThemeTemplateOptions { const defaultValues: Readonly<ThemeTemplateOptions>; } export declare class ThemeCreator { /** * @description Creates a new theme from the given template theme CSS and theme palettes and loads it for use with the given name. * @param options The options to use to create the new theme. * @return The compiled theme CSS. */ static createFromTemplate(options: TemplateThemeCreationOptions): string; private static substituteThemeHex; private static substituteThemeRgba; /** @description Compute the palette offset from an associated hex color regex match. */ private static hexOffset; /** @description Compute the palette offset from an associated rgba color regex match. */ private static rgbaOffset; /** @description Compute the alpha channel from an associated rgba alpha regex match. */ private static rgbaAlpha; } export declare namespace ThemeCreator { interface PaletteBase { "50": string; "100": string; "200": string; "300": string; "400": string; "500": string; "600": string; "700": string; "800": string; "900": string; "A100": string; "A200": string; "A400": string; "A700": string; } interface Palette extends PaletteBase { contrast: PaletteBase; } }