Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions lib/src/lib/themes/vscode-color-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ type ThemePalette = Record<VscodeThemeKind, string | null>;

export const THEME_KINDS: readonly VscodeThemeKind[] = ['dark', 'light', 'hcDark', 'hcLight'];

export const NULL_COLOR = Symbol('null-color');
export type ResolvedColor = string | typeof NULL_COLOR;

const REGISTRY_DEFAULTS: Record<string, ThemePalette> = {
'--vscode-foreground': {
dark: '#CCCCCC',
Expand Down Expand Up @@ -332,18 +329,10 @@ export const RESOLUTION_RULES: readonly ResolutionRule[] = [
{ name: '--vscode-terminal-ansiBrightWhite' },
];

export function registryDefault(name: string, themeKind: VscodeThemeKind): ResolvedColor {
const defaults = REGISTRY_DEFAULTS[name];
if (!defaults) return NULL_COLOR;

const value = defaults[themeKind];
if (value) return value;
return NULL_COLOR;
}

export function registryDefaultValue(name: string, themeKind: VscodeThemeKind): string | null {
const value = registryDefault(name, themeKind);
return value === NULL_COLOR ? null : value;
const defaults = REGISTRY_DEFAULTS[name];
if (!defaults) return null;
return defaults[themeKind] || null;
}

export function coerceThemeKind(themeKind: VscodeThemeKind | 'dark' | 'light'): VscodeThemeKind {
Expand Down
Loading