import { Node } from "../common/node"; import { Atom } from "./atom"; import { Shade } from "../common/shade"; import { PropertyStringSelectable, PropertyString } from "../common/props"; import { IAtoms, IColorPalette, IColor, ColorListener, ShadeFilter } from "../interfaces"; /** * The ColorPalette atom. * @category Atoms */ export declare class ColorPalette extends Atom implements IColorPalette { private readonly colors; /** The default color name property */ readonly defaultColorName: PropertyStringSelectable; private readonly colorListeners; constructor(atoms: IAtoms); /** * Add a color to the color palette. * @param name The name of the color to add to the palette * @param hex The hex value of the color to add to the palette * @returns The color added to the palette */ addColor(name: string, hex: string): Color; /** * Remove a color from the color palette. * @param name The name of the color to remove from the palette */ removeColor(name: string): void; /** * Set a color listener which is called when a color is added or removed from the palette. * @param name The name of the color listener. * @param cb The callback function to call when a color is added or removed. */ setColorListener(name: string, cb: ColorListener): void; /** * Get a list of all color names in the palette. * @returns Return a list of string names for the colors. */ getColorNames(): string[]; /** * Get a color by name, or throw an exception if not found. * @param colorName The name of the color to return. * @returns The color object */ getColor(colorName: string): Color; /** * Returns the default color, if any. * @returns The default color (if any). */ getDefaultColor(): Color | undefined; /** * Get the default color name (if any). * @returns The default color name. */ getDefaultColorName(): string | undefined; /** * Get all colors in the palette. * @returns Returns all colors in the palette. */ getColors(): Color[]; /** * Return all light or dark mode colors which match the filter. If no filter is provided, return all. * @param type Either 'lm' for light mode or 'dm' for dark mode. * @param filter An optional filter * @returns Returns all light mode or dark mode colors which match the filter (if any). */ getColorShades(type: string, filter?: ShadeFilter): Shade[][]; /** * Get all light mode shades matching the filter * @param filter An optional filter which must be matched * @returns The matching light mode shades */ getLightColorShades(filter?: ShadeFilter): Shade[][]; /** * Get all dark mode shades matching the filter * @param filter An optional filter which must be matched * @returns The matching dark mode shades */ getDarkColorShades(filter?: ShadeFilter): Shade[][]; /** * Return a 1-based index for this color in the palette. * @param color A color * @returns A 1-based index for this color */ getColorIndex(color: Color): number; serialize(): any; deserialize(obj: any): void; } /** * A color. * @category Atoms */ export declare class Color extends Node implements IColor { /** The 0-based index of the color, in the order in which it was added */ index: number; /** The hex value for the color */ hex: PropertyString; /** The generated light mode shades for the color */ light: ColorMode; /** The generated dark mode shades for the color */ dark: ColorMode; private palette; constructor(name: string, index: number, hex: string, palette: ColorPalette); getIndex(): number; private buildShades; toString(): string; deserialize(obj: any): void; serialize(): any; } /** * A color mode (light or dark) with all related shades. * @category Atoms */ export declare class ColorMode extends Node { /** The name of the mode: "lm" or "dm" */ readonly name: string; readonly color: Color; /** The generated shades associated with this color and mode */ readonly shades: Shade[]; constructor(name: string, color: Color, opts?: { quarterShade?: boolean; halfShade?: boolean; }); private buildShades; }