bengamesquad [Lexaloffle Blog Feed] Colorblind Mode Example <p>~ ~ INSTRUCTIONS ~ ~<br /> Open the main menu (e.g. with Enter), toggle the COLORBLIND option, and then select CONTINUE to see the result.</p> <p> <table><tr><td> <a href="/bbs/?pid=95714#p"> <img src="/bbs/thumbs/pico8_fepasozuti-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=95714#p"> Colorblind Mode Example</a><br><br> by <a href="/bbs/?uid=56837"> bengamesquad</a> <br><br><br> <a href="/bbs/?pid=95714#p"> [Click to Play]</a> </td></tr></table> </p> <p>~ ~ INFO ~ ~<br /> Hi all!</p> <p>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 &quot;colorblind mode&quot;, and that's where this code snippet comes from. </p> <p>This is not perfect at all, but basically it manipulates the palette to give much better contrast <em>in many situations</em> 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).</p> <p>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! </p> <p>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 :) </p> <p>~ ~ RESULTS ~ ~<br /> 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. </p> <img style="margin-bottom:16px" border=0 src="/media/56837/2_colorblind_mode_examples.png" alt="" /> <p>All simulations are provided by: <a href=""></a></p> <p>~ ~ CODE EXPLANATION ~ ~<br /> 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 &quot;system&quot; table which contains a &quot;settings&quot; table, and that settings table contains the flag for whether the mode is on or not. I opted for a string value (&quot;off&quot; vs &quot;on&quot;) 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.</p> <p>For the drawing, it simply checks whether the colorblindness mode is &quot;on&quot;, 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> Fri, 06 Aug 2021 17:32:41 UTC