@ux-aspects/ux-aspects
Version:
Open source user interface framework for building modern, responsive, mobile big data applications
49 lines (48 loc) • 2.03 kB
TypeScript
import { ColorSet } from './color-sets/index';
import { ThemeColor } from './theme-color';
import * as i0 from "@angular/core";
export declare class ColorService {
private _colorSet;
/** Set the default theme to the Keppel colorset */
private _theme;
/** Allow the color set to be provided in a forRoot function otherwise set it to the Keppel theme by default */
constructor();
/**
* Get a ThemeColor object from a color name
* @param colorName The name of the color from the color palette
*/
getColor(colorName: ColorIdentifier): ThemeColor;
/**
* Get the active color set
*/
getColorSet(): ColorSet;
/**
* Define the current color set and produce a Theme from it
*/
setColorSet(colorSet: ColorSet): void;
/**
* Resolve a color value. This may be the name of a color from the color set
* or it may simply be a hex or rgb(a) color value. This function will return
* a CSS color value regardless of which one of these formats it is
* @param value The color name, hex code or rgb(a) value to resolve
* @returns If the color is the name of a color in the set, the `rgba` color will be returned, otherwise the original CSS value will be returned.
*/
resolve(value: string): string;
/**
* Converts a color name to an appropriate ColorSet name. For example
* a color may be written in lower-camel-case, however color sets are in
* kebab-case. This will convert to the appropriate naming format
* @param colorName The color name to resolve
*/
resolveColorName(colorName?: string): string;
/** Determine if the current colorset has a specific color */
colorExists(name: string): boolean;
/** Create a theme from a colorset */
private getTheme;
static ɵfac: i0.ɵɵFactoryDeclaration<ColorService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ColorService>;
}
export interface Theme {
[name: string]: ThemeColor;
}
export type ColorIdentifier = string;