Improve contrast in the default colour palette
I've recently been investigating legibility in the Terminal. As part of this, I tested the default palette that's in master using the Contrast app. This shows the contrast ratio for a background and foreground colour, as well as a rating according to the Web Content Accessibility Guidelines.
I also did a quick comparison between the default palette in the Terminal, compared with some other popular code editors.
I found that the contrast for the default colour palette was quite low, and performed fairly poorly according to the WCAG ratings. The code editors that I looked at seemed to perform better.
My findings are included below, along with some suggested colours that perform better in terms of contrast. It's not really possible to ensure contrast without having an idea about what the background colour is, so I'm proposing two default colour palettes - one for a dark background and one for a light background.
I'm no expert on how colours work in terminals. I've had a few people test using a dconf command and have had positive responses. However, it doesn't seem like the palette is used universally by all commands; I'm not sure why that is.
Dark background
Terminal master Proposed
Colour HEX GNOME Palette Contrast A11Y score HEX GNOME Palette Contrast A11Y score
Foreground #FCFCFC #FFFFFF
Background #242424 #1E1E1E
0 Black #241f31 Dark 4 1.0:1 FAIL #5E5C64 Dark 2 2.5:1 FAIL
1 Red #C01C28 Red 4 2.5:1 FAIL #ED333B Red 2 4.1:1 A
2 Green #33D17A Green 5 7.8:1 AAA #2EC27E Green 4 7.3:1 AAA
3 Yellow #B5835A Brown 2 4.7:1 AA #F6D32D Yellow 3 11.3:1 AAA
4 Blue #1E5098 ? 2.0:1 FAIL #3584E4 Blue 3 4.4:1 A
5 Magenta #A347BA ? 3.2:1 FAIL #C061CB Purple 2 4.6:1 A
6 Cyan #30B7CB ? 7.0:1 AAA #30BFCB ? 7.0:1 AAA
7 Light grey #DEDDDA Light 3 11.4:1 AAA #DEDDDA Light 3 12.3:1 AAA
8 Dark grey #5E5C64 Dark 2 2.4:1 FAIL #77767B Light 5 5.9:1 AA
9 Light red #ED333B Red 2 3.8:1 A #F66151 Red 1 5.4:1 AA
10 Light green #33D17A Green 3 7.8:1 AAA #33D17A Green 2 10.1:1 AAA
11 Light yellow #F8E45C Yellow 2 12.0:1 AAA #F8E45C Yellow 2 12.9:1 AAA
12 Light blue #1C71D8 Blue 4 3.3:1 FAIL #62A0EA Blue 2 6.1:1 AA
13 Light magenta #C061CB Purple 2 4.3:1 A #DC8ADD Purple 1 6.9:1 AAA
14 Light cyan #38DAF3 ? 9.2:1 AAA #38DAF3 ? 9.9:1 AAA
To test, run: dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/palette "['rgb(36,31,49)', 'rgb(237,51,59)', 'rgb(46,194,126)', 'rgb(246,211,45)', 'rgb(53,132,228)', 'rgb(192,97,203)', 'rgb(48,191,203)', 'rgb(222,221,218)', 'rgb(119,118,123)', 'rgb(246,97,81)', 'rgb(51,209,122)', 'rgb(248,228,92)', 'rgb(98,160,234)', 'rgb(220,138,221)', 'rgb(56,218,243)', 'rgb(255,255,255)']"
Light background
Tested with foreground #FFFFFF and background #000000.
Terminal master Proposed
Colour HEX GNOME Palette Contrast A11Y score HEX GNOME Palette Contrast A11Y score
0 Black #241F31 Dark 4 16.0:1 AAA #241F31 Dark 4 16.0:1 AAA
1 Red #C01C28 Red 4 6.1:1 AA #C01C28 Red 4 6.1:1 AA
2 Green #33D17A Green 5 2.0:1 FAIL #218d5b Custom 4.2:1 A
3 Yellow #B5835A Brown 2 3.3:1 FAIL #D09609 Custom 2.2:1 FAIL
4 Blue #1E5098 ? 7.9:1 AAA #1A5fb4 Blue 5 6.3:1 AA
5 Magenta #A347BA ? 4.8:1 AA #9141AC Purple 3 5.9:1 AA
6 Cyan #30B7CB ? 2.4:1 FAIL #29878B Custom 4.3:1 A
7 Light grey #DEDDDA Light 3 1.4:1 FAIL #9A9996 Light 5 2.8:1 FAIL
8 Dark grey #5E5C64 Dark 2 6.6:1 AA #77767B Dark 1 4.5:1 AA
9 Light red #ED333B Red 2 4.1:1 A #E01B24 Red 3 4.8:1 AA
10 Light green #33D17A Green 3 2.0:1 FAIL #26A269 Green 5 3.3:1 FAIL
11 Light yellow #F8E45C Yellow 2 1.3:1 FAIL #E5A50A Yellow 5 2.2:1 FAIL
12 Light blue #1C71D8 Blue 4 4.8:1 AA #1C71D8 Blue 4 4.8:1 AA
13 Light magenta #C061CB Purple 2 3.6:1 A #C061CB Purple 2 3.6:1 A
14 Light cyan #38DAF3 ? 1.7:1 FAIL #0A95AE Custom 3.5:1 A
To test, run: dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/palette "['rgb(36,31,49)', 'rgb(192,28,40)', 'rgb(33,141,91)', 'rgb(208,150,9)', 'rgb(26,95,180)', 'rgb(145,65,172)', 'rgb(41,135,139)', 'rgb(154,153,150)', 'rgb(119,118,123)', 'rgb(224,27,36)', 'rgb(38,162,105)', 'rgb(245,194,17)', 'rgb(28,113,216)', 'rgb(192,97,203)', 'rgb(10,149,174)', 'rgb(255,255,255)']"