@furystack/shades-common-components
Version:
81 lines • 2.12 kB
TypeScript
import { EventHub, type DeepPartial } from '@furystack/utils';
export type Color = string;
export type ColorVariants = {
main: Color;
light: Color;
dark: Color;
};
export interface Palette {
primary: ColorVariants;
secondary: ColorVariants;
error: ColorVariants;
warning: ColorVariants;
success: ColorVariants;
info: ColorVariants;
}
export interface Text {
primary: Color;
secondary: Color;
disabled: Color;
}
export interface ButtonColor {
active: Color;
hover: Color;
selected: Color;
disabled: Color;
disabledBackground: Color;
}
export interface Background {
default: Color;
paper: Color;
}
export interface Theme {
name: string;
palette: Palette;
text: Text;
button: ButtonColor;
background: Background;
divider: Color;
}
export declare class RgbColor {
r: number;
g: number;
b: number;
a: number;
constructor(r: number, g: number, b: number, a?: number);
update(key: 'r' | 'g' | 'b' | 'a', value: number): RgbColor;
toString(): string;
}
/**
* Service class for theme-related operations
*/
export declare class ThemeProviderService extends EventHub<{
themeChanged: DeepPartial<Theme>;
}> {
/**
* @deprecated does not respect CSS vars
* @param color The background color
* @param bright The Bright color
* @param dark The Dark color
* @returns The bright or dark color variant that fits the background color
*/
getTextColor(color: string, bright?: string, dark?: string): string;
/**
*
* @param color The color string
* @returns The parsed R,G,B, A values
*/
getRgbFromColorString(color: string): RgbColor;
readonly theme: Theme;
private _assignedTheme;
/**
* Returns the last assigned theme object
*/
getAssignedTheme(): DeepPartial<Theme>;
/**
* Assigns a new theme, updates the CSS variables and emits a themeChanged event
* @param theme The Theme instance
*/
setAssignedTheme(theme: DeepPartial<Theme>): void;
}
//# sourceMappingURL=theme-provider-service.d.ts.map