Skip to content

Commit 7b09fb4

Browse files
authored
feat: make graphite the default theme (#57)
1 parent ac84eb4 commit 7b09fb4

3 files changed

Lines changed: 47 additions & 42 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Hunk reads config from:
134134
Example:
135135

136136
```toml
137-
theme = "midnight" # midnight, graphite, paper, ember
137+
theme = "graphite" # graphite, midnight, paper, ember
138138
mode = "auto" # auto, split, stack
139139
line_numbers = true
140140
wrap_lines = false

src/ui/themes.ts

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -76,43 +76,6 @@ function withLazySyntaxStyle(theme: Omit<AppTheme, "syntaxColors" | "syntaxStyle
7676
}
7777

7878
export const THEMES: AppTheme[] = [
79-
withLazySyntaxStyle({
80-
id: "midnight",
81-
label: "Midnight",
82-
appearance: "dark",
83-
background: "#08111f",
84-
panel: "#0e1b2e",
85-
panelAlt: "#13243a",
86-
border: "#284264",
87-
accent: "#7fd1ff",
88-
accentMuted: "#355578",
89-
text: "#eef4ff",
90-
muted: "#8da5c7",
91-
addedBg: "#153526",
92-
removedBg: "#47262a",
93-
contextBg: "#0f1b2d",
94-
addedContentBg: "#102a1f",
95-
removedContentBg: "#371b1e",
96-
contextContentBg: "#132238",
97-
addedSignColor: "#69d69a",
98-
removedSignColor: "#ff8e8e",
99-
lineNumberBg: "#0b1627",
100-
lineNumberFg: "#56739a",
101-
selectedHunk: "#20466a",
102-
badgeAdded: "#5ad188",
103-
badgeRemoved: "#ff8b8b",
104-
badgeNeutral: "#89a5d3",
105-
}, {
106-
default: "#e8f1ff",
107-
keyword: "#8ed4ff",
108-
string: "#c7b4ff",
109-
comment: "#6e85a7",
110-
number: "#ffd883",
111-
function: "#b6c9ff",
112-
property: "#a8d6ff",
113-
type: "#a4b7ff",
114-
punctuation: "#6e85a7",
115-
}),
11679
withLazySyntaxStyle({
11780
id: "graphite",
11881
label: "Graphite",
@@ -150,6 +113,43 @@ export const THEMES: AppTheme[] = [
150113
type: "#d3d9e2",
151114
punctuation: "#7f8b97",
152115
}),
116+
withLazySyntaxStyle({
117+
id: "midnight",
118+
label: "Midnight",
119+
appearance: "dark",
120+
background: "#08111f",
121+
panel: "#0e1b2e",
122+
panelAlt: "#13243a",
123+
border: "#284264",
124+
accent: "#7fd1ff",
125+
accentMuted: "#355578",
126+
text: "#eef4ff",
127+
muted: "#8da5c7",
128+
addedBg: "#153526",
129+
removedBg: "#47262a",
130+
contextBg: "#0f1b2d",
131+
addedContentBg: "#102a1f",
132+
removedContentBg: "#371b1e",
133+
contextContentBg: "#132238",
134+
addedSignColor: "#69d69a",
135+
removedSignColor: "#ff8e8e",
136+
lineNumberBg: "#0b1627",
137+
lineNumberFg: "#56739a",
138+
selectedHunk: "#20466a",
139+
badgeAdded: "#5ad188",
140+
badgeRemoved: "#ff8b8b",
141+
badgeNeutral: "#89a5d3",
142+
}, {
143+
default: "#e8f1ff",
144+
keyword: "#8ed4ff",
145+
string: "#c7b4ff",
146+
comment: "#6e85a7",
147+
number: "#ffd883",
148+
function: "#b6c9ff",
149+
property: "#a8d6ff",
150+
type: "#a4b7ff",
151+
punctuation: "#6e85a7",
152+
}),
153153
withLazySyntaxStyle({
154154
id: "paper",
155155
label: "Paper",
@@ -237,5 +237,5 @@ export function resolveTheme(requested: string | undefined, themeMode: ThemeMode
237237
return THEMES.find((theme) => theme.id === "paper") ?? THEMES[0]!;
238238
}
239239

240-
return THEMES.find((theme) => theme.id === "midnight") ?? THEMES[0]!;
240+
return THEMES.find((theme) => theme.id === "graphite") ?? THEMES[0]!;
241241
}

test/ui-lib.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe("ui helpers", () => {
7272

7373
test("buildAppMenus creates checked entries from the current shell state", () => {
7474
const menus = buildAppMenus({
75-
activeThemeId: "midnight",
75+
activeThemeId: "graphite",
7676
focusFiles: () => {},
7777
focusFilter: () => {},
7878
layoutMode: "stack",
@@ -105,7 +105,12 @@ describe("ui helpers", () => {
105105
"Line numbers",
106106
"Line wrapping",
107107
]);
108-
expect(menus.theme.some((entry) => entry.kind === "item" && entry.label === "Midnight" && entry.checked)).toBe(true);
108+
expect(
109+
menus.theme
110+
.filter((entry): entry is Extract<MenuEntry, { kind: "item" }> => entry.kind === "item")
111+
.map((entry) => entry.label),
112+
).toEqual(["Graphite", "Midnight", "Paper", "Ember"]);
113+
expect(menus.theme.some((entry) => entry.kind === "item" && entry.label === "Graphite" && entry.checked)).toBe(true);
109114
});
110115

111116
test("fitText and padText clamp using the terminal fallback marker", () => {
@@ -180,7 +185,7 @@ describe("ui helpers", () => {
180185

181186
expect(midnight.id).toBe("midnight");
182187
expect(missingLight.id).toBe("paper");
183-
expect(missingDark.id).toBe("midnight");
188+
expect(missingDark.id).toBe("graphite");
184189
expect(resolveTheme("ember", null).syntaxStyle).toBeDefined();
185190
});
186191
});

0 commit comments

Comments
 (0)