logsdx
Version:
<div align="center"><img alt="logsdx" width="300" src="https://github.com/user-attachments/assets/cc2a3b55-5bfd-44e8-a330-bfa146b50059" /></div>
80 lines (78 loc) • 2.3 kB
TypeScript
import type { Theme, StyleOptions, PatternMatch } from "../types";
export interface ColorPalette {
primary?: string;
secondary?: string;
accent?: string;
error?: string;
warning?: string;
info?: string;
success?: string;
debug?: string;
text?: string;
background?: string;
muted?: string;
highlight?: string;
[key: string]: string | undefined;
}
export interface ThemePreset {
name: string;
patterns: PatternMatch[];
words?: Record<string, StyleOptions>;
}
export interface SimpleThemeConfig {
name: string;
description?: string;
colors: ColorPalette;
mode?: "light" | "dark" | "auto";
presets?: string[];
customWords?: Record<string, string | StyleOptions>;
customPatterns?: Array<{
name: string;
pattern: string | RegExp;
color: string;
style?: string[];
}>;
defaultTextColor?: string;
whiteSpace?: "preserve" | "trim";
newLine?: "preserve" | "trim";
}
export declare const THEME_PRESETS: Record<string, ThemePreset>;
/**
* Create a theme from a simple configuration
*/
export declare function createTheme(config: SimpleThemeConfig): Theme;
/**
* Create a theme with sensible defaults and a simple color palette
*/
export declare function createSimpleTheme(name: string, colors: ColorPalette, options?: Partial<SimpleThemeConfig>): Theme;
/**
* Extend an existing theme with modifications
*/
export declare function extendTheme(baseTheme: Theme, modifications: Partial<SimpleThemeConfig>): Theme;
/**
* Check WCAG compliance for a theme
*/
export declare function checkWCAGCompliance(theme: Theme): {
level: "AAA" | "AA" | "A" | "FAIL";
recommendations: string[];
details: {
normalText: {
ratio: number;
};
};
};
/**
* Adjust theme for accessibility by improving contrast ratios
*/
export declare function adjustThemeForAccessibility(theme: Theme, targetContrast?: number): Theme; /**
*
Fluent theme builder class (stub implementation)
*/
export declare class ThemeBuilder {
private config;
constructor(name: string);
colors(palette: ColorPalette): ThemeBuilder;
mode(mode: "light" | "dark" | "auto"): ThemeBuilder;
build(): Theme;
static create(name: string): ThemeBuilder;
}