@@ -55,18 +55,44 @@ 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 : {
62- accents : [
63- "blue" ,
64- "green" ,
65- "yellow" ,
66- "red" ,
67- "pink" ,
68- "purple" ,
69- ] . map ( color => tokens [ `data/${ color } /color/emphasis` ] ) ,
95+ accents : spectrum . map ( color => tokens [ `data/${ color } /color/emphasis` ] ) ,
7096
7197 "background.appearance" : "opaque" ,
7298
@@ -247,16 +273,7 @@ export function getTheme({ themeKey, name, type }) {
247273 "warning.border" : tokens [ 'borderColor/muted' ] ,
248274
249275 "players" :
250- [
251- "blue" ,
252- "orange" ,
253- "pink" ,
254- "green" ,
255- "purple" ,
256- "yellow" ,
257- "teal" ,
258- "red"
259- ] . map ( color => ( {
276+ spectrum . map ( color => ( {
260277 "cursor" : tokens [ `data/${ color } /color/emphasis` ] ,
261278 "background" : tokens [ `data/${ color } /color/emphasis` ] ,
262279 "selection" : alpha ( `data/${ color } /color/emphasis` , 0.4 )
0 commit comments