I'm creating a game. Color coding is its main gameplay feature. What colors should I choose so the game will be colorblind-friendly? (I need 4 colors)
There are different kinds of color blindness which occur in different intensities.
The most frequent ones are red-green blindness and yellow-blue blindness (each indicating which two colors affected people can not tell apart).
Here are different forms of color blindness and how frequently they occur in the general population. Source of these numbers is the Wikipedia article on color blindness:
men women red-green 9% 0.5% blue-yellow < 1% <1% all colors (negligible)
As you can see, red-green blindness is by far the most common form of color blindness. However, it predominately affects men. For women, it is even less frequent than the next most frequent kind: blue-yellow blindness. So keep your target demographic in mind when you prioritize different kinds of color blindness.
The most flexible way to take care of any form of color-blindness is simply to make the colors used by your game configurable in the options menu. That way every player can set a color combination which works for them.
Or you can use this palette from the article Color Universal Design (CUD) How to make figures and presentations that are friendly to Colorblind people by Masataka Okabe and Kei Ito.
By the way: You might want to skim the whole article. While it focuses on scientific presentations in front of an audience, it also has plenty of advise which is transferable to game design.
Here's a copy paste friendly version of the above picture:
(0,0,0,100) (0.50,100,0) (80,0.0,0) (97,0,75,0) (10,5,90,0) (100,50,0,0) (0,80,100,0) (10,70,0,0)
(0,0,0) (230,159,0) (86,180,233) (0,158,115) (240,228,66) (0,114,178) (213,94,0) (204,121,167)
(0,0,0) (90,60,0) (35,70,90) (0.60,50) (95,90,25) (0,45,70) (80,40,0) (80.60,70)
#000000 #E69F00 #56B4E9 #009E73 #F0E442 #0072B2 #D55E00 #CC79A7
I'm mainly red/green color blind. The colors I always choose when given a choice in situations like this, are:
Those I can always tell apart.
Color combinations I have problems with are mainly the following:
- Sky-blue/light grey
- Purple/dark blue
Hope it helps :-)
The following is informed by my experience as someone with slight red/green colorblindness - specifically protanomaly.
When choosing colors, think about differentiating colors by brightness in addition to just hue.
A naive approach in choosing colors is to say "Okay, I need four colors. Let's go with primaries: red, green, blue and yellow. So that's #FF0000, #00FF00, #0000FF, and #FFFF00. Done!"
The problem with this approach is that all your colors are sitting at maximum brightness. Someone who has difficulty with red/green colorblindness might not be able to tell the difference between maximally bright yellow (red+green) and maximally bright green (or red).
Instead, in addition to spacing the colors out by hue, you should also space them by brightness. For example, don't have bright green and bright yellow, but have a dark green versus a bright yellow, to help out those people who may have red/green colorblindness. Even if they can't distinguish the hue of the color, they can tell that the colors are different by their brightness.
This isn't a foolproof method, of course. There's a wide range of colorblindness types, and certain types are less about not being able to distinguish between different colors and more about not having the same sensitivity to particular wavelengths, so the perceived brightness for a colorblind person will be different than for a non-colorblind person. (This is what happens with my protanomaly. I'm less sensitive to red light than the average person, so reds are darker for me than for others: really dark red is easily confused with black, and I can pick up the green much better than the reds in fully saturated computer yellow, so it's easily confused with fully saturated computer green, as are dark blues with dark purples. - Though I can still pick up large differences in brightness.)
Adding a "colorblind mode" where something else besides color (e.g. shapes) is used to distinguish things is also a good idea. But keep in mind that there's a range of severity in colorblindness, and many "colorblind" people can still perceive colors. So your "colorblind mode" should add extra distinguishing factors, rather than replacing the color. (I've seen games which turn everything black & white in "colorblind mode".) Ideally you should be able to have your "colorblind" features on all the time.
But one thing you definitely want to do is to extensively play test you game with things "de-hued". Either through some colorblindness simulator (but remember the multiple types), or simply by converting everything to greyscale. I've experienced a few games whose "colorblind mode" was obviously an afterthought. For example, one game just added numeric labels to the colored balls. The problem with this was that the game was time-sensitive and distinguishing between a 2 and a 3 is harder (takes a fraction of a second longer) than distinguishing between colors. So levels that were comfortable for normal sighted persons using colors were unplayable to someone relying on the labels.
Whenever I need to pick a set of colours, I use colorbrewer. Even though it is technically for maps, you can it for everything, and they let you choose between different pallets based on your preferences (like colour blindness).
There are different types of colorblindness, so you may not be able to be friendly with all of them, but the two major types are red-green and blue-yellow colorblindness.
This means that these people have trouble differenciating red from green or yellow from blue. So for your game, try avoiding red AND green at the same time (same goes for yellow and blue).
To add to the other answers, you can use a colorblindness simulator such as Color Oracle to detect problems with your color scheme.
Also, while this may not be applicable to your game, Jon Blow of The Witness made sure that puzzles which depended on discerning different colors were optional.