react-antd-cssvars
Version:
A minimal cssvars antd module
66 lines (65 loc) • 2.87 kB
TypeScript
export declare const DThemeColorTypes: [
"primary-color",
"secondary-color",
"danger-color",
"success-color",
"warning-color",
"description-color",
"disable-color",
"border-color",
"primary-color-hover",
"secondary-color-hover",
"danger-color-hover",
"primary-color-background",
"secondary-color-background",
"danger-color-background",
"success-color-background",
"warning-color-background",
"text-color",
"text-color-inv",
"disable-background",
"background-hover",
"background-selected",
"table-head-text-color",
"table-head-background",
"table-head-background-hover",
"table-head-background-selected",
"table-head-background-selected-hover",
"menu-background",
"submenu-background",
"menu-text-color",
"box-shadow-color"
];
export declare type TThemeColorTypes = typeof DThemeColorTypes[number];
export declare const ThemeColorKeys: TThemeColorTypes[];
export declare type hex = string;
export declare type TTheme<T extends string> = {
[key in T]?: string;
};
export interface IValue {
hex: hex;
luminance: number;
alpha: number;
}
export declare type TThemeComputed<T extends string> = (key: T, value: string, luminance: number, alpha: number) => void;
export declare class Theme<T extends string> {
static ThemeColorKeys: ("primary-color" | "secondary-color" | "danger-color" | "success-color" | "warning-color" | "description-color" | "disable-color" | "border-color" | "primary-color-hover" | "secondary-color-hover" | "danger-color-hover" | "primary-color-background" | "secondary-color-background" | "danger-color-background" | "success-color-background" | "warning-color-background" | "text-color" | "text-color-inv" | "disable-background" | "background-hover" | "background-selected" | "table-head-text-color" | "table-head-background" | "table-head-background-hover" | "table-head-background-selected" | "table-head-background-selected-hover" | "menu-background" | "submenu-background" | "menu-text-color" | "box-shadow-color")[];
theme: TTheme<T>;
default: TTheme<T>;
computed?: TThemeComputed<T>;
private themeColorKeys;
constructor(theme?: TTheme<T>, computed?: TThemeComputed<T>, themeColorKeys?: T[]);
private keyToProperty;
set(key: T, value: hex, computed?: boolean, alpha?: number): void;
has(key: T): boolean;
get(key: T): hex;
reset(): void;
reverse(key1: T, key2: T): void;
static getLuminance(color: hex): number;
static getAlpha(color: hex): number;
static tint(hex: hex, weigth: number): hex;
static shade(hex: hex, weigth: number): hex;
static complement(hex: hex): hex;
static isdark(hex: hex): boolean;
static mix(color1: hex, color2: hex, percent?: number): hex;
}