feat(editor): allow customizing active line and editor UI colors
This commit is contained in:
1 parent
951f0a21a0
commit
252f8a0d1f
19 files changed
+204
-9
No files matched your search
@@ -5,7 +5,9 @@ import {
|
||||
AI_PROVIDER_PARTNER_PRESETS,
|
||||
AI_PROVIDER_PRESETS,
|
||||
DEFAULT_CUSTOM_THEMES,
|
||||
DEFAULT_CUSTOM_THEME_COLORS,
|
||||
DEFAULT_EDITOR_SETTINGS,
|
||||
type CustomThemeColors,
|
||||
EXECUTE_MODE_CURRENT_DEFAULT_VERSION,
|
||||
SIDEBAR_BROWSE_OBJECTS_MIGRATION_VERSION,
|
||||
enforceRightSidebarPanelExclusivity,
|
||||
@@ -131,6 +133,39 @@ describe("normalizeEditorSettings", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves optional UI colors in customThemes and customThemeColors", () => {
|
||||
const customColors: CustomThemeColors = {
|
||||
...DEFAULT_CUSTOM_THEME_COLORS,
|
||||
background: "#101010",
|
||||
foreground: "#f0f0f0",
|
||||
activeLine: "#202020",
|
||||
selection: "#303030",
|
||||
cursor: "#ff00ff",
|
||||
gutterBackground: "#151515",
|
||||
lineNumber: "#666666",
|
||||
matchingBracket: "#444444",
|
||||
};
|
||||
const normalized = normalizeEditorSettings({
|
||||
customThemeColors: customColors,
|
||||
customThemes: [
|
||||
{
|
||||
id: "custom-1",
|
||||
name: "My Custom",
|
||||
colors: customColors,
|
||||
ddlColors: DEFAULT_CUSTOM_THEMES[0].ddlColors,
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(normalized.customThemeColors.activeLine).toBe("#202020");
|
||||
expect(normalized.customThemeColors.selection).toBe("#303030");
|
||||
expect(normalized.customThemeColors.cursor).toBe("#ff00ff");
|
||||
expect(normalized.customThemeColors.gutterBackground).toBe("#151515");
|
||||
expect(normalized.customThemeColors.lineNumber).toBe("#666666");
|
||||
expect(normalized.customThemeColors.matchingBracket).toBe("#444444");
|
||||
expect(normalized.customThemes[0].colors.activeLine).toBe("#202020");
|
||||
expect(normalized.customThemes[0].colors.gutterBackground).toBe("#151515");
|
||||
});
|
||||
|
||||
it("normalizes customThemes when empty or absent by seeding DEFAULT_CUSTOM_THEMES", () => {
|
||||
// When customThemes is an empty array
|
||||
const normalizedEmpty = normalizeEditorSettings({ customThemes: [] });
|
||||
|
||||
@@ -769,8 +769,25 @@ export interface CustomThemeColors {
|
||||
builtin: string;
|
||||
background?: string;
|
||||
foreground?: string;
|
||||
activeLine?: string;
|
||||
selection?: string;
|
||||
cursor?: string;
|
||||
gutterBackground?: string;
|
||||
lineNumber?: string;
|
||||
matchingBracket?: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_CUSTOM_THEME_OPTIONAL_COLORS: Partial<Record<keyof CustomThemeColors, string>> = {
|
||||
background: "#1e1e2e",
|
||||
foreground: "#cdd6f4",
|
||||
activeLine: "#313244",
|
||||
selection: "#313244",
|
||||
cursor: "#f5e0dc",
|
||||
gutterBackground: "#181825",
|
||||
lineNumber: "#6c7086",
|
||||
matchingBracket: "#45475a",
|
||||
};
|
||||
|
||||
export const DEFAULT_CUSTOM_THEME_COLORS: CustomThemeColors = {
|
||||
keyword: "#cba6f7",
|
||||
field: "#f9e2af",
|
||||
|
||||
Reference in new issue
Block a user