Log In  
Follow
bengamesquad
Follow

~ ~ INSTRUCTIONS ~ ~
Open the main menu (e.g. with Enter), toggle the COLORBLIND option, and then select CONTINUE to see the result.

Cart #fepasozuti-0 | 2021-08-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

~ ~ INFO ~ ~
Hi all!

I've been messing around with PICO-8 after using it briefly a little while ago, and I've been having a lot of fun! But I was working on a game that involved a red ball on green grass, and I realized that this wouldn't be very accessible to a lot of players with colorblindness, even if the contrast was really nice for players without colorblindness. I decided, in my case, the best solution was to add a simple "colorblind mode", and that's where this code snippet comes from.

This is not perfect at all, but basically it manipulates the palette to give much better contrast in many situations for the three common types of colorblindness (red-blind, green-blind, and blue-blind), though most of all for red- and green-blindness, mainly focusing on shifting reds to orange and greens to blue (as suggested by the various accessibility manuals I looked at).

Whether this is the best choice, or even necessary at all (it's probably always best to design your game so that it's not necessary if possible, but this can be difficult with such a limited palette and resolution, I know!), will depend a lot on your use case, so you can see some results below and weigh your options. But going by the simulations below, and the valuable feedback from my friend who has red-blindness, I think it's a decent start!

Also, I'd like to add that I'm not colorblind at all, and so I'm really working off of feedback from my friend, best practice recommendations, and these simulations, so any feedback from people with colorblindness or people with experience with these sorts of things would be very much appreciated :)

~ ~ RESULTS ~ ~
The left column is with the mode off and the right column is with the mode on. The first row is with no colorblindness simulation, the second row is with simulated red-blindness / protanopia, the third row is with simulated green-blindness / deuteranopia, and the fourth and final row is with simulated blue-blindness / tritanopia.

All simulations are provided by: http://www.color-blindness.com/coblis-color-blindness-simulator/

~ ~ CODE EXPLANATION ~ ~
As far as the code, it's pretty simple, really. There might be more efficient ways of doing this (well, not having to look into a table within a table would be marginally faster, at least!), but basically I just have a global "system" table which contains a "settings" table, and that settings table contains the flag for whether the mode is on or not. I opted for a string value ("off" vs "on") in case I wanted to add different modes to specifically optimize the experience for different types of colorblindness, but this could be easily switched to a bool.

For the drawing, it simply checks whether the colorblindness mode is "on", and if so it sets the palette accordingly, switching back to the default palette if not. Everything drawn after that palette switch is drawn with the shifted, colorblindness-friendly palette, so you could, for example, place this after most of your game is drawn, but before UI elements are drawn, in order to ensure contrast and clarity in the UI without shifting other colors.

P#95714 2021-08-06 17:32

Follow Lexaloffle:        
Generated 2021-09-22 02:46:46 | 0.075s | Q:9