refactor(vscode): simplify accent color derivation
This commit is contained in:
@@ -212,14 +212,8 @@ export const buildVSCodeThemeFromPalette = (palette: VSCodeThemePalette): Theme
|
|||||||
// This makes inactive tabs and secondary text clearly distinguishable from active/primary text
|
// This makes inactive tabs and secondary text clearly distinguishable from active/primary text
|
||||||
const rawMutedFg = read('descriptionForeground', base.colors.surface.mutedForeground);
|
const rawMutedFg = read('descriptionForeground', base.colors.surface.mutedForeground);
|
||||||
const mutedFg = applyAlpha(rawMutedFg, palette.kind === 'light' ? 0.55 : 0.5);
|
const mutedFg = applyAlpha(rawMutedFg, palette.kind === 'light' ? 0.55 : 0.5);
|
||||||
// Prefer VS Code's "added diff" color as our primary accent when available (users expect this to match their theme).
|
// Prefer stable UI colors for accent to avoid theme-specific diff values.
|
||||||
const diffInserted = palette.colors['diffEditor.insertedTextBorder']
|
const accent = read('button.background', read('textLink.foreground', base.colors.primary.base));
|
||||||
?? palette.colors['diffEditor.insertedLineBackground']
|
|
||||||
?? palette.colors['diffEditor.insertedTextBackground']
|
|
||||||
?? palette.colors['gitDecoration.addedResourceForeground'];
|
|
||||||
const accent = diffInserted
|
|
||||||
? forceOpaque(diffInserted)
|
|
||||||
: read('button.background', read('textLink.foreground', base.colors.primary.base));
|
|
||||||
const accentFg = read('button.foreground', base.colors.primary.foreground || base.colors.surface.background);
|
const accentFg = read('button.foreground', base.colors.primary.foreground || base.colors.surface.background);
|
||||||
const hoverBg = read('list.hoverBackground', read('editor.selectionBackground', base.colors.interactive.hover));
|
const hoverBg = read('list.hoverBackground', read('editor.selectionBackground', base.colors.interactive.hover));
|
||||||
const activeBg = read('list.activeSelectionBackground', hoverBg);
|
const activeBg = read('list.activeSelectionBackground', hoverBg);
|
||||||
@@ -239,9 +233,7 @@ export const buildVSCodeThemeFromPalette = (palette: VSCodeThemePalette): Theme
|
|||||||
const badgeBg = read('badge.background', accent);
|
const badgeBg = read('badge.background', accent);
|
||||||
const badgeFg = read('badge.foreground', foreground);
|
const badgeFg = read('badge.foreground', foreground);
|
||||||
|
|
||||||
const success = diffInserted
|
const success = read('testing.iconPassed', base.colors.status.success);
|
||||||
? forceOpaque(diffInserted)
|
|
||||||
: read('testing.iconPassed', base.colors.status.success);
|
|
||||||
const successBg = applyAlpha(success, palette.kind === 'light' ? 0.12 : 0.16);
|
const successBg = applyAlpha(success, palette.kind === 'light' ? 0.12 : 0.16);
|
||||||
const successBorder = applyAlpha(success, palette.kind === 'light' ? 0.35 : 0.45);
|
const successBorder = applyAlpha(success, palette.kind === 'light' ? 0.35 : 0.45);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user