apphouse
Version:
Component library for React that uses observable state management and theme-able components.
45 lines (44 loc) • 1.54 kB
TypeScript
import { Color } from './Color';
import { ColorType } from './utils/color.interface';
import { Colors, PaletteType, ThemeModeType } from './palette.interface';
export declare class Palette {
title: string;
id: string;
description?: string;
mode: ThemeModeType;
colors: Colors;
sortColorsBy: 'key' | 'color';
/**
* The theme id for which this palette is for
*/
themeId: string;
/**
* When palette is copied or imported from another theme it will have a
* reference to the original theme id
*/
referenceThemeId: string;
constructor(palette?: PaletteType);
get objectify(): PaletteType;
static autoGenId: (title: string) => string;
get sortedColors(): Color[];
setTitle: (value: string) => void;
setId: (id: string) => void;
addColors: (colors: ColorType[]) => void;
setColors: (colors: Record<string, ColorType>) => void;
appendColors: (colors: Colors) => void;
setColor: (color: Color) => void;
setMode: (mode: ThemeModeType) => void;
setDescription: (value: string) => void;
setReferenceThemeId: (id: string) => void;
get colorsList(): Color[];
addColor: (key: string, value: ColorType) => void;
removeColor: (key: string) => void;
deleteAllColors: () => void;
getColorFromKey: (key: string) => string | undefined;
/**
* ColorType[] --> Record<string, Color>
* @param colors colors list
* @returns the colors list in Color
*/
static colorify: (colors?: ColorType[]) => Colors;
}