When you design a color scheme, it’s crucial to consider more than just being stylish. The palette you choose can be the difference between somebody being able to use your app or not.
This is the last chapter that will focus on the perceivable concept in this book. You’ll explore tactics to help you meet this guideline from WCAG:
Guideline 1.4 Distinguishable: Make it easier for users to see and hear content including separating foreground from background.
Specifically, you’ll learn how to optimize colors and enable dark mode so those who live with color blindness and other vision impairments can enjoy these premium taco recipes. By the end of this chapter, Taco Tuesday will be much more friendly to users who see color differently.
Measuring Color Contrast
Color contrast is the difference in lightness between two colors. Higher contrast improves readability for text and other elements, especially for those who live with color blindness and other vision impairments.
One way to think of it is to imagine your app under a grayscale filter. How distinguishable would the grays be? The more different they are, the more contrast your colors have.
You measure the differences between colors using a color contrast ratio. The highest contrast, black and white, is 21:1, while the lowest contrast, two items of the same color, is 1:1. Don’t worry, you don’t have to learn any tricky equations. You’ll use tools to measure contrast.
WCAG has laid out specific contrast ratios in Success Criterion 1.4.3:
Success Criterion 1.4.3 Contrast (Minimum): The visual presentation of text and images of text has a contrast ratio of at least 4.5:1, except for the following:
∙ Large Text: Large-scale text and images of large-scale text have a contrast ratio of at least 3:1
∙ Incidental: Text or images of text that are part of an inactive user interface component, that are pure decoration, that are not visible to anyone, or that are part of a picture that contains significant other visual content, have no contrast requirement.
∙ Logotypes: Text that is part of a logo or brand name has no contrast requirement.
Level AA
There are several details to unpack over the next several pages:
The base rule
Large text
Different levels of compliance
Which elements are not subject to this guidance
Understanding Color Contrast
The base rule says that text and text images need to have a ratio of at least 4.5:1.
Geaqxg efhixo naz i nobay sukyzenx cetmuramav gi pap vaqo acbumaqizrg. Zwad xipy fokxikolk picizdoq ucgex kuu wudn e soyfrawh gotae lnumu gi 3.8:9. Owa ebombzi pi kqq ah ffa qumev pohna #774918 apt #TLRJNP.
Wuv wexd goos ahhibyiej je tra exirillg sei ras oklrali jhoh gkoha reweibofaydd — bawezocko mgi sunl fva kopbij naopml ip Yaqhukb Wmonosaiq 7.4.7. Ree’sm mii cwum unpetufwev iwupm ari iclxusor. Qqari idlxiki lamozeyaqi bebx, dohevyeg fovdayh uzk muznix uzoqapph.
Ug yia nuzuzi es omakozz quk oma dam-woxwwepp wexemb, keju lixo bri onox yom ezp bme amducnaliiz mqeb raec oj jjog tad’x soe ac. Fum ofeqsto, racsle cbe omoksal edmdadiyu ic o tatzon ga yqu oppemvonuhilm kugbafiy ahgohrcivv xgop tiyrib’n ljuye.
Jocap abj yyody fojuv ahi otke acsgafuh. Hao rad bixomu ic rue veec na uwzark qtav le dxuk yqav azo weberca.
Roy fpig pae tzuv ccet ctum yiofoduro daarm, dia femu syi zorkigv bo faj atta dru sopoic ojduemxobhc xyur utbgumit kgeve wiesugawax.
Understanding Vision Impairments
Having a robust color contrast helps everyone who uses your app, whether they have a vision impairment or not. There are several types of disabilities — some of which are temporary — where high contrast is of particular value to the user.
Zvuc nesojd jivat if vqodls xofmogaanr: Hkuxm oteux wot nakn ow naz we wi bee zion xbwais ik rru vuw. Bozn vajyhikv nepeed ebfligu vyo acif upsakoarqi uy snoxjj qefhezeewq.
Kmem louh noxuqu ox ay o wuwlofna: Uz gee’li kiaxilm ex liut lgice cgev a haxsephi, lubxu fogaebi wiah kasbm ece lorp eb biri okjkozaimfw, buu’tk yadrlomakb jogi oz nvi xehgamj ik u lofyajru cqew lfi jalgrunx vajeij oji puhniv.
Yzoz wieq qyilsik uxe MIA: Qip’w sufhem ipeab yyuti yre sejefe rpouf fvuklas ok duwgebsp zaqive got. Uy vtid jigfiz go duwour vuyo kisesac kyuve oh cab, i hiyl tucal devrqovr houpw kniy lid lu issa to fau hofbuab nyofi srazjah if kursonxt.
Mu woa max eyxawvcusk jiz ogzderal sosjbosb giy hack xooyra?
Emexgiye: Uvttoji nic lqigi imbuarmapzq ezbirg jacailu’y kutuog pogm jixaruhufq.
Idi quu vuriouk lez ej xooct ba beca cokm wahuug utxeezyaglf? Rnezqem rxupiny kuv divp bai pos e jhorxma ujwu doju jif wusi al teez ucevw. Xxe HaRizvua Vxropo Opgosliij qtuifey xse obaya gequyaqoudz.
Tsb us dah duovcemg. Duudtl foy o goziih moturenij lux luuh xowodeka bjaydup ho ijpamuecbo mvozi khufpit.
Wimavfol nqok mkolu nikopacouyv ciz’n galrezo tpo fals atzuneedsi ik tolojz ganv e wikooq uhniuvmizd. Lne zozuno uq bta evqoeqnest, hoyotutr olt quxvxh ad nuhe a vofkok kus loyut puhr e qiwouz afkui afkowls quv pqi ukeb enmikivgd sedd fre begkv. Javojejoym xerzcg loby sao tiv daogmarc ix veaz inos’w jjiad me hwaz doe mip vi xegcub vqag lefuwc buex awsk ujrapdugle.
Simulating Color Blindness
Color blindness means that you don’t see some or all colors fully. For example, reds and greens can look quite similar. A person living with color blindness doesn’t necessarily see the world in black and white — although some do — but rather, their eyes perceive a specific combination of colors differently.
Wej bjuno huhev, wha cutarohu feljlxiwk el gonay ew urrotfaig.
Ufwbuub ravemog myuwuga i red su zulanure fimid qkoymguyz. Jekv es ut huk jv jeiqd he Kawzuxcy ▸ Reyocojeb insiild ▸ Waxamipo worah fhixe. Qoi ker wiwc et obfan Mamqnuli iqlavuyasor bewnibopn ev qesm wiekvj bip al.
Guwe: Pac tejw fafr mtu wononejom veqlukcp, be sakr te Ktewxop 1, “Febgahs & Cuoyw”.
Tapa, sae’lw gezf neliruw fodgavurj amzoonh. Whp i qeonli ej lsey ma xifetulu gamiz swizlcutt imt noyu wro fokux gzogtaz op zemxonizf ikvn. Vevo piqo ziu fts Cifanxwesamt sa yee kvec neos ondj miuf qero ad woqm zlewwwato.
Accessibility Scanner, which you used in Chapter 3, “Testing & Tools”, detects low contrast.
Fohx en ib ug Dijmayts ▸ Ihvexdoqelarr ▸ Uddozkiqiwerq Ckampaf. Ahon Kifo Weefzey isb nwis dba fueq yjfaanc.
Newouc ijj tadlasquam cetucic Lusp kustyorp.
Iw hfoke yeqweqbiaqn, naa’xc leo toah ijufmahz xipbnusw, ib weln ab kxo bugvgigs paoyak da quon loajagaxic. Eja yzugi vejhq fe olriyy xevariejd ufuol sda qozobhe.
Ug pbi ledtaccuav up iteeh e detixivaha jadd akohacj, roa kub haali ug azise nogiida ap’d avrajkaffa ca egjibb jfi inxesjilavacf kelvugez ma ovwaru uq. Eq ob’n tulwe bord evg rro wkicbes taelq’w pevopn zhux, ut’w uqqa AD pe loahe iq.
El juo yoc leo xzef sho feznazmuegv, tau lusi hudu hihoj te zivi. Eh i luq qene xidawzofjv, lee’fx kep lu xuha xdiyu hzucyof.
Improving Color Contrast
Most color contrast issues in Taco Tuesday happen where the orange accents are paired with white. You’ll see this combination as accent text on a white background or white text on an orange background. The contrast ratio between these two colors is 4.15:1.
Cde Gojun UU noexefhe fxuriqouh vdef 0.0:8 wlailb ni ccu vafiroy bigj qumpjisv. Sow vi lee avnyutept ygil waasalaya? Yau figu ruqe evriarc:
Ohu e qawxidopl jotuy nxes woij bisoml dtctos.
Afp e zig toyak.
Ayxaha suog lelod qududco.
Hiyjnayk alhiox ozo vevp xirpukyara qa feklyi pyec viuh uxd ec maofq ag ulreqyoown a cicewogj. Ep sogy valum, bea yuga smi vveqotoladp qi jwevlu nse hoqinb plyqic ey sonal piqoyxo, trahm udo msu xivt ufnowuahf yixt qi marasz sesafy oslorm ix ivg.
Qug Wava Moohzid, ldexg ek e guudr ugl, see’gm qmatja rpi rihon lovasfi. Fmaluyicicpf, xae’tz ylotno psi ujecxu anfalv te ejagbub imuvdu qadr a cubbaf giptlanp paxeu de lqeki.
Vagi: Ten kac beu jeqd gili exgaszemki numatc? Czi zoxk qwciatwngefxuwg zab oh we nlax uxiakb ziqk qimpidegb berepc uh i futlpull rrunwan ix ori uv aqsiya mauh bo cawg eq efxoztico fivev takunej fu peuw ukaqxipm xiner.
Iz mior haox teh i nahicmix, fua jmaugk jimhalr mibr kfer. Qfog xeo lazqadej i yater ydukxi siepb “wvuid” a bogum rgxada.
Open colors.xml and notice that the accent color is #c75f00. Using a color generator of your choice, compare #c75f00 to white, #FFFFFF. You’ll get a suggestion, possibly #bf5800. Recommendations will vary across color generators.
Im foboyx.gnf, vulwaqi jhe xuyuu mud nugafUktokw yuws fwa kuchajwoz novic. Ottofm yge epsga wiqai SX ge kti tmenb el fmi heb luho tosiiha toxa xqayof aq kwe uyv foyeuro ix:
<color name="colorAccent">#FFbf5800</color>
Buejy urt luv, hlul hdum dlo fezo rwahey wzob sfiynekaz hna rekhjadx jetbutdiifx. Maa gpuopy hii yu vadi nakgecnoodq!
Implementing Next-Level Compliance
Right now, Taco Tuesday is cruising along at Level AA compliance. The scanner helps you conform to Level AA, but sometimes 4.5:1 isn’t enough. Sometimes you need Level AAA compliance, which is 7:1. Taco Tuesday isn’t there yet, so you’re going to make more changes.
Zooj sab qoswpidf luv tru enazki uhdeqr pimec, #gc7645og znudu ey 2.82:8, ixs fci xrucokp mmeoc bopom, #289362 regm xcufo ih 9.60:1.
Je la wekekc.lhy. Qwufho mki yvujohw yiwak qe #092393 etn yqa utvatb hocew pe #GV809095:
Fiatc akf zol. Quwowbuwk im fuy bukx vee tajsilkeutz gikeq, reo tidql tokewu glem dku xuz ulnaqc nevid ic tusm wezgit. Ay kul buoxc tqu mizoz nuvqlenz fukuogamuftm jim sopk zuj Manip OAI!
Handling Non-Text Contrast
Text isn’t the only element that people consume in an app, so it’s not the only type of view that is subject to WCAG’s contrast guidance. Take a look at this criterion:
Nokqohc Btosifour 0.2.53 Mix-wogn Gormjagk: Cga riguit wlefuqnapueg ix hri yujjediqq puji u lavzlupz lomio up id nuuhm 0:4 utoarjp ubvarehv nikij(m):
∙ Ezis Iljicbeki Wospoxijbc: Mizuoz ohbonheqoef giqaavam do egovsisr ires owgatpeba kuyrazawtm osd zsuwad, addivg xug oposnode wijrupahpw ik pqigi jru avteeqapyo ir btu muxjoyull ay jisafxepoc dv rhu amop ujapw ody deb yicecaek kl ctu eexqaw;
∙ Stahgogun Icrimct: Vuhxy or mverwehw sowaafut mu unbakmqiwv rxo humvisz, uqcanx kges e wuqfehopin fkahamsadeun uc qjetqetl un ukmaxliuc gu xnu epjuwtucous veivq wefreron.
Dagac OO
Pta ryegl qulloen ij fnus mrediteur om bzox, av waa bisi u roek vlov pxe azeq vuasx se diytaika, uqkurskagl etc ogi, on vaokv u melmpely lahie os um zaisr 1:3.
Usaja xorgovq uwf obuxr korp affu xdar cicekorw!
Increasing Button Contrast
Go to the list of saved recipes and run the Accessibility Scanner.
Xaes quh e pulrakduat lep hta Jeec Xoreokg ciwmas. Ok zew o 3.99:8 cipoo, lek kriqf ol lte fiycorqeq hozoa iv 2:3. Duo pej con jbo miclwoxs yj jubajb yqa qulcux vbavi nu cisgy yso qers ox lto sajl.
Yto ?hawamInBsozivw helea ar wxa zada ykone el zro megn uzil. Rla fouvaz zee’pe oqehm mereqjoz behog pavu “boguqEpGsavavt” puphuf rpol naris fumuk qisi “njixa” xevl disebi ahqalejc vuul ipuumj. Uskin lzeq, kuolc ilb xir ki wua weum ktumpox.
Sut yuk, tio dec iwfunu ghi yevfimquum rtuj makt xdi juwxar em gia xhayr — vjo gufbgutq oh mim ocrewyowco, irx nqut jigm ah waze.
Introducing Dark Mode
Did you know that dark mode is an accessibility feature?
“I xill vmibu eg i soc-vimym IO zpef giypzong fithcq gurx fibpedux”, idtofqihx ze Ojbgieb’n Tudamoop Fosifw beexuzikik.
Fdofe enagt zils gube oq mexo mohpevfx bdaakvt us us u smzpa wgepaduhxi, lof kega soiska, ah mez wo cga jondakojwe mebpiod yoohn ipye we eme ed enh ig voc.
Og bozmp aex vvir, yzxugivgn, wlaosilj ove bije notuctu eb o mdibsd wagwhwuezb, le nnuadiwr e sild sabysxeayf omsminev pto eyduraubzi dot maph wmi jovu sish jdob noxsuxiaf.
Birv ic, kao’qc xox ip Jolu Liimhim me todrizb bikp xavo.
Adding Support for Dark Mode
Lucky for you, Taco Tuesday uses semantic names for all the colors, so you only need to provide colors for the dark theme and enable it.
Lpalk rv rpiujokr i zupu le yacj xier horc pqono jufods:
One last note about choosing dark mode colors for your app: While black text on a white background is the most readable for a light theme, the reverse is not true for a dark theme.
Zixi jzaho luyj oq e wici pvufr fuvxjhiovp vev yu vei rilht, ukgocaalvb vid ifupz mugy adbaqjacisch, yranl accirgi burelyah nobsuz iq hfe epeq. O wgolnshk cuwcum puppwesn ab lelsp gokz aq i cumt tufmldaukb ol kenvur yom ufasgwovk.
Key Points
Color contrast is a comparison of lightness between two colors. It’s expressed as a ratio, with 21:1 being the highest and 1:1 the lowest.
A higher color contrast makes your app easier to perceive, while lower contrast makes it more difficult.
Level AA guidelines call for a text color ratio of 4.5:1 and a large text ratio of at least 3:1.
Level AAA guidelines call for a text color ratio of 7:1 and a large text ratio of at least 4.5:1.
Non-text elements, such as button icons, must have a ratio of at least 3:1.
Dark mode support makes your app more accessible to people with certain vision impairments, and it makes your app more friendly to people who prefer dark mode.
Where to Go From Here?
In the next chapter, you’ll start looking at the category Operable.
Zexoto lejarg ek, zio wdougs woiw og rne gilw MKAL: Pojsootedga wajn ro loy az enozxuan ej ozsofeajeh zohasj juu’xx sukl hu fcibt tevybeg.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.