dynamic-theme-lib
Version:
A flexible and powerful theme management library for Angular applications that allows dynamic color management and theme switching.
43 lines (42 loc) • 1.55 kB
TypeScript
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import * as i0 from "@angular/core";
export declare class ColourService {
private http;
private platformId;
private colorMap;
private isBrowser;
private storageKey;
private configUrl;
private colorsSubject;
colors$: Observable<{
[key: string]: string;
}>;
constructor(http: HttpClient, platformId: object);
/**
* Method to fetch the color configuration and load colors from sessionStorage or JSON.
*/
private loadColorConfig;
/**
* Method to update color for a specific variable and store it.
* @param variableName The key for the color variable (e.g., 'primary-color')
* @param colorValue The new color value (e.g., '#ff5733')
*/
setColor(variableName: string, colorValue: string): void;
/**
* Method to get the color for a specific variable.
* @param variableName The key for the color variable (e.g., 'primary-color')
* @returns The color value for the given variable or an empty string if not found
*/
getColor(variableName: string): string;
/**
* Method to get all colors (useful for UI configuration or preview page).
* @returns All color configurations
*/
getAllColors(): {
[key: string]: string;
};
reloadColors(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ColourService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ColourService>;
}