@socketsecurity/lib
Version:
Core utilities and infrastructure for Socket.dev security tools
79 lines (78 loc) • 2.27 kB
TypeScript
import type { ColorValue } from '../spinner';
import type { ShimmerColorGradient } from '../effects/text-shimmer';
import type { Theme, ThemeColors, ColorReference } from './types';
/**
* Resolve color reference to concrete value.
* Handles semantic keywords: 'primary', 'secondary', 'rainbow', 'inherit'
*
* @param value - Color reference
* @param colors - Theme palette
* @returns Resolved color
*
* @example
* ```ts
* resolveColor('primary', theme.colors)
* resolveColor([255, 0, 0], theme.colors)
* ```
*/
export declare function resolveColor(value: ColorReference | ColorValue, colors: ThemeColors): ColorValue | 'inherit' | ShimmerColorGradient;
/**
* Resolve shimmer color with gradient support.
*
* @param value - Shimmer color
* @param theme - Theme context
* @returns Resolved color
*
* @example
* ```ts
* resolveShimmerColor('rainbow', theme)
* resolveShimmerColor('primary', theme)
* ```
*/
export declare function resolveShimmerColor(value: ColorReference | ColorValue[] | undefined, theme: Theme): ColorValue | ShimmerColorGradient | 'inherit';
/**
* Extend existing theme with custom overrides.
* Deep merge of colors and effects.
*
* @param base - Base theme
* @param overrides - Custom overrides
* @returns Extended theme
*
* @example
* ```ts
* const custom = extendTheme(SOCKET_THEME, {
* name: 'custom',
* colors: { primary: [255, 100, 200] }
* })
* ```
*/
export declare function extendTheme(base: Theme, overrides: Partial<Omit<Theme, 'colors'>> & {
colors?: Partial<ThemeColors> | undefined;
}): Theme;
/**
* Create new theme from complete specification.
*
* @param config - Theme configuration
* @returns Theme object
*
* @example
* ```ts
* const theme = createTheme({
* name: 'custom',
* displayName: 'Custom',
* colors: {
* primary: [255, 100, 200],
* success: 'greenBright',
* error: 'redBright',
* warning: 'yellowBright',
* info: 'blueBright',
* step: 'cyanBright',
* text: 'white',
* textDim: 'gray',
* link: 'cyanBright',
* prompt: 'primary'
* }
* })
* ```
*/
export declare function createTheme(config: Pick<Theme, 'name' | 'displayName' | 'colors'> & Partial<Omit<Theme, 'name' | 'displayName' | 'colors'>>): Theme;