Skip to content

Commit c774016

Browse files
authored
Merge pull request #33 from claytercek/main
Add vim mode colors, colorized bracket colors, and better colorblindness support
2 parents fad5af1 + 645b092 commit c774016

2 files changed

Lines changed: 310 additions & 261 deletions

File tree

src/theme.js

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,45 @@ export function getTheme({ themeKey, name, type }) {
5555
return '#' + color;
5656
}
5757

58+
let spectrum = [
59+
"blue",
60+
"green",
61+
"yellow",
62+
"red",
63+
"pink",
64+
"purple",
65+
];
66+
67+
if (themeKey.includes('colorblind')) {
68+
// protonopia and deuteranopia friendly spectrum
69+
// TODO: these colors were determined by simulating colorblindness digitally
70+
// and picking colors that were more easily distinguishable. A more
71+
// thorough approach with input from colorblind users would be better.
72+
spectrum = [
73+
"blue",
74+
"cyan",
75+
"yellow",
76+
"pink",
77+
];
78+
} else if (themeKey.includes('tritanopia')) {
79+
// tritanopia friendly spectrum
80+
// TODO: these colors were determined by simulating colorblindness digitally
81+
// and picking colors that were more easily distinguishable. A more
82+
// thorough approach with input from colorblind users would be better.
83+
spectrum = [
84+
"teal",
85+
"yellow",
86+
"purple",
87+
"pink",
88+
];
89+
}
90+
5891
return {
5992
appearance: type,
6093
name,
6194
style: {
95+
accents: spectrum.map(color => tokens[`data/${color}/color/emphasis`]),
96+
6297
"background.appearance": "opaque",
6398

6499
"background": tokens['bgColor/default'],
@@ -221,21 +256,24 @@ export function getTheme({ themeKey, name, type }) {
221256
"unreachable.background": tokens['bgColor/disabled'],
222257
"unreachable.border": tokens['borderColor/disabled'],
223258

259+
// Using functional tokens as they have sufficient contrast for colorblindness
260+
// themes, even though they don't really match the functional intent here.
261+
"vim.mode.text": tokens['fgColor/default'],
262+
"vim.normal.background": tokens['bgColor/neutral-emphasis'],
263+
"vim.helix_normal.background": tokens['bgColor/neutral-emphasis'],
264+
"vim.visual.background": tokens['bgColor/accent-emphasis'],
265+
"vim.helix_select.background": tokens['bgColor/accent-emphasis'],
266+
"vim.insert.background": tokens['bgColor/success-emphasis'],
267+
"vim.visual_line.background": tokens['bgColor/accent-emphasis'],
268+
"vim.visual_block.background": tokens['bgColor/done-emphasis'],
269+
"vim.replace.background": tokens['bgColor/sponsors-emphasis'],
270+
224271
"warning": tokens['fgColor/attention'],
225272
"warning.background": tokens['bgColor/muted'],
226273
"warning.border": tokens['borderColor/muted'],
227274

228275
"players":
229-
[
230-
"blue",
231-
"orange",
232-
"pink",
233-
"green",
234-
"purple",
235-
"yellow",
236-
"teal",
237-
"red"
238-
].map(color => ({
276+
spectrum.map(color => ({
239277
"cursor": tokens[`data/${color}/color/emphasis`],
240278
"background": tokens[`data/${color}/color/emphasis`],
241279
"selection": alpha(`data/${color}/color/emphasis`, 0.4)

0 commit comments

Comments
 (0)