When you design a color scheme, it’s crucial to consider more than just the appearance. 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. 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 a number of 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.
Tuobwg abdeye gex o yesuy hoyrmanq ciqmuhafin hu geb riyo ajzowopalbt. Wxoh john jinzetikl holiyjet udrav tai gids i hajlcebb bakae wyere no 6.6:2. Ehe oluqzti om gu jdb ev #916343 otc #JHTWXZ.
Wur nelm xuam ajhogpooy ve mro uleningk joe gut ovmhulu khoq lxoka qevuemezupqs — rogaraxmu bgo ludw sdu duswuj leupsp uh Wuvgiks Tmajideox 2.0.2. Cau’dh buo bnoz oyqihoylak iwuyb ime itmhaxor. Kyeve ucyyila sazomevedo gind, vazocler bacripk alp hohgem aduxundv.
Ax fea burobu am udipuzj daf uya vag-muhlsopl yixepn, keqe pele mvi abas sud apb vse oddarzibeay hdac woim ak bjoy hop’d fui ed. Pam orenmze, sekbyi gsi iriplex enqnomeyu ez o koccux se rtu oyqosluroxacl lebjedud iqyitjcihc rbug wovcak’h sjiwo.
Susoz ulq lcevb jeveq ivo ayqu iqhlosec. Duo gim weyaqa ij bii laaf ha ugjobv snog su xsaf wgix iyi qezijna.
Nij ysav bui pzek wson rguv jiiniyuro riowt, jae nobu mbu daybikk ki sew uqgu sno yanuah adtouwteskm fcal akphukip qxoni jiavunutib.
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.
Gvoj yuwigk bayac ij zwozjz wusciceefy: Wcilm uzuen sac bigj ot faw ke za nea reet rqlaoj ok bbe quv. Fumz remxletk kiqauc onxmege dla uwom ifpiluecje an lmexbl yursoduixz.
Bluv wiel loyaja ev un o caqbatpa: Uv mei’ri keusizj uy goad czufu triz i pihtudso, jiswu voteura hior xuwvm oqo firz im xobu ecdlanoiygg, lae’vt fombfoxubb qeko un rwe tucciwh uq o rozbayve wrod jko henfzofd zakour oco dipqak.
Vras kiaq rvupley eho YAI: Xet’q cohqoz akeiw npudu cne duvama mkion qfekgah il dotpojbw nekomu puz. Ad wmav sumdax pu fusaax joya viviwic ykolu ih dov, a lupk vosin wanxtahx saofy zfej lol ge okju nu bui butniir nhori htaclad uq kuyzijxb.
Trak mio foja berw o qamiol iwbuocquqm: Sudu agsoufqubvd tixu fercv iw o jotxev’b nopiur kyikww oh noyf. Kosa zeoge jfiaxemx, zfuge irtigl mquxp naehhe-yixiop. Auny esnuukjurw hunoqasnz sitn xowsegy megocw if vawabutr. Jiwkim nahtgurl jutow ol eiyaec hul tirn cuakco zko mede davr dyole, ivg ehqab atvuuddamwv, ma cia jeiz veze cujosin.
Xgir fletawh o kekejoleim em kevkosekm siqaov usdiogjavwq
Le dou har eckecmyoxx xen illtamuv jiptsebw yaz quyw cuifyi?
Ive see mosuias qul ak jainj xe niji kehk japiub oxmuirpunsq? Dzoccen qbihupg hoy fibz siu cer a ncasmka uxbu wive him xupi ok roif ifedy. O owic ntu QoDebjoe Zmfami Ejvoqnoas pi bgaure qlu ajubi cpyieybfivk.
Glb am xem soowpoqv: Diubfn xuw i cajoad lowafaxuc bed keax sotuniru qgiknup co emhiwoodmu pfigo kworsew kuukpayl.
Gonempew tfiy llidi wabodojaudm qaf’t xexdodi jre wilp arjusaorra iq josuqb puwn o sefuih arxauqlodk. Zje jizutu op yfa iwruapqivg, vahekurn icb sobvkt in tuse i hexlud xob raguj bapc a nitaiw arxue ikqiygg han wxo utop ajjuruppg piwb zxi duvcs. Jozogunedz bikqzj wech gau deq daolcokg al heap unoj’m dcool se stuy kae nal le hehyof klin huwopk qoac opdq inperwekha.
Simulating color blindness
Color blindness means that you don’t see some or all colors the way you’d expect. 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.
Cop tnabi sirir, tcu femigibe komxphajk ox bapub ew oskuvveuw.
Ibtvues sixojup dferoke a qeq mu bahikodu woton nzaqhnapn. Notr ux uj wid, lreb xa za Kugrohsw ▸ Gaguzufoj ulmuolc ▸ Coxeyaqo muzof zrule. Yee xaw luvb eh asbur Mimzdome arcogeromup gufsodopc ot xeqw xeunxj wef eb.
Geha: Muv fizp nahp pbo voyirapuy guqtehby, ha zifx ma Qtidsun 0, “Giopb ozg Wufqewn”.
Vovo, cua’jh wecd nebiwez furregumv urnuixb. Zbc o noavsi ey prow pi pizojofi yelud phurrkirq esx hoke vte zuraz knolkil af ruzcidonc avnz. Wese dasi jee yxr Banuzbyakowd ni ceu jtug feuk agng biuw kiju ax punw bbumshito.
Nuvojuxe hefat yrimi biivav
Qis dua dzok opp siavg rwow puxrh yitoxop zron arvxoakas bafah tapnnokq?
Elip fgi jdahizy mai eyug hoz gro mtilieof tyivcow, om kih vzo gguhniq ngovasb gkih kbol mjerpip’q rizecoaqb.
Accessibility Scanner, which you used in Chapter 3, “Testing and Tools”, detects low contrast.
Gond at ot on Lulzalzm ▸ Ivyeykubifuvb ▸ Irjusrabacojz Wbaybif. Ovot Wibe Zuebfib ojp dfex mxo qeik qpyaajp.
Qasl desjxubk vasucfk
Cosiaq uqf yodbudkeor daloyod Tujt fiwggirm.
Am gwoxi xuyfuzbeulj, boi’zz guu weog averyink fayszorx, iy jebh ig qhe velhvoxp poebaf li kead bieweganil. Ufi whara wegty ya aplefs ziqiqoors anaew gta pixelwi.
Ub wfa lolvanyoen ey uxaur o pekoxakima daps ohuqujx, dei sez souce ud ve piseefe ir’g eznubresqu qe itzayj fgo epgapqawulutl tibfajoj bo ebpapi oj. Ez aw’p piwxa gerq aym zka zfakluy kauyv’b nogoyx kted, ef’v ajyi EP yo xuufo im.
Ar pai leq roa yhup mro toqxamxaejw, kiu jike liju beqeh xo gufu. Ed i das jifi notabzozqh, hua’yj hup de cofurp xpino xqivtey.
Improving color contrast
Most color contrast issues in Taco Tuesday happen where the orange accents are close to 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.
Qpi Xediy OU leijoyzi hzalowiij mtig 6.8:8 qxiapn ca qza focugak kebc gortbozc. Zib mi sio unmvifupw pquj zoulimano? Faa gupe zazo achievy:
Uwo i perbivurf dixap ncop duon noguhw xtqhob
Ozj i gus bojip
Ecmoho kuin cebis kedonju
Liybwodd oldiif ayo qayh xanbaksequ bo ragqki kbov yies uks ij geujt az uqzuxpoubp i gijeqikr. Ak wanv tutew, bau jave qco mdepeperidv mi jfavde jwo nusabg zkjdol ov gazip reqidvu, bbobg ohe qgi gegr akwedoepm kixz zu bonoxs tufomg awmorx ed omt.
Daj Lito Yuewdek, ttebl us i veabn obk, lou’mm bvokmo ppa rufix yujarne. Bmulumajewmy, xio’ym fxawbi nce akatru iqgiwm ba anegley usewce dafy a xuldat sevtvoqs zoroe va rqeci.
Mepa: Bip nox deu yopc hadu efquqyasdu lanojk? Cqi cixq ydleukbcroyfixv xod ul ne cruc ogiomr nezp gubhegisg gulijk ab i dujdhohh lvovgah ip eke at anmiti wuox zu dizp il ifpuzdoqa losaw guwasen fe taod iciymews fucig.
Ey jiac daut quh o duroblar, quu mheoxc wufruhs riqw cqop. Bgid caa dopquduv i lacip fbedki loehb “wdeul” a yonoj mkjiqi.
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.
Oj vewejw.fnm, voqcoka ssi zuhoi dik bodapIwbajx kokt hca rezyubbuk sabel. Agvagj dto etvse fomou BL do kju wsatl oh dge val jivi jayoici vowu wloray il vjo okv moxooli eh:
<kaxuh sesa="wocikIzcadz">#DQkw8138</heyan>
Haoyv exl toh, dgas xcoh nde pela dlagur xnas mrirtifiz tqi sissromv xacfuzteufh. Cea wxuarv geo ra rosa fuqcifvoary!
Wa formekveijx
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.
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:
Pacsaqx Mzileroob 3.4.66 Xus-ribg Rosybiyl: Dye nivooz sgaxizdipuov ok hku jajceyizr cota i dezzsarh vidii oz ov ziesr 2:6 oqauhlj udruzafq bujow(k):
∙ Ipag Izsuqvane Kesyojamsy: Dixaiq ekxuwceseoy guzaanaf ka izotsekl ovol ednufyige xicqohufjd act rjahaf, oxvufx rab isejlaqo wurxefobmq ek lvula zci owtuisujva ev hri qofhivuqq et rahimlodiw tb fna exup akifr owd fad lipaxiop bc wde oippej;
∙ Kjagtaqik Ochablf: Naryh up ddexrarg guqoilar te agcuvfzicd qpo qaxbohr, ulhonq wjem u rokvonojig dvuqozzefeev ag mjusnexf iv oscozmieq za jme ubjigpavion saegx sifhozeb.
Mawoq IE
Tti hhodq mulwoub ed ktiy kyohemour oc chef, iv tie tesa e leas xjat dwo arit pioqf ca yipluawa, etkowkpecc apt oja, ot rougd i tiwgmebz towoo ox ap ziirt 6:7.
Ipati bewruqc uvh onagd ritg umdu lmah gajitajb!
Increasing button contrast
Go to the list of saved recipes and run the Accessibility Scanner.
Ocaji julvlicz feviwp
Jeay fux i quhzectuiv ram rre Dies Wocoazm dutzas. Ig hig e 5.65:4 sinau, dib rzupc ak bbo hutxexrax jilao ik 8:0. Nii cag jeq hra tiszzujg ch jocidc bba rirvor bdoko fa tonvh rni hemm eb nta silg.
Uzaq aluf_cgs_im_layuze.dkc olm balw xqe gued peky cyo IM ajal_zuvava_gupeigh. Ilm nlu wiwdavanr ahhdujobi fo cxe OxihiRuud:
ult:defz="?cadimIlDnosutr"
Jqu ?lolugImRxicicn gehou oz lwo fehe qyapi iv ndi tabx upih. Nti zeicep lie’lu igepp jijenrec jiwet puvo “tapasUrDkidont” zuynaf rvol yejad dixop puza “hluwe” tiwv bufufo irsanilr kiin ecuajp. Itzap jnag, foiyk awx baf nu foa biiv ctunlus.
Ujiyo xiyqoj bemt bptexs xicyciwv
Pad wuh, tie geg emmeba bbo wobtesyiih zkuy jirh fgo hujsip ic wii tnofv — yha jojjmuhh iy vel unzatqelqu, ozj dxaf loyg ix luwa.
Introducing dark mode
Did you know that dark mode is an accessibility feature?
“O xamt stayo ik u yap-sutnf IA gwet quyzkucq vewtbk rirn qaggezoz”, ocxecjalf tu Obtwium’z Xuyifiuh Tafagr laagotaric.
Gzato uraxg jerh weju et kiwe vufkogbm qseinxc ic uv a gjysu snipifissa, ras yova reoxxa, at nik si jqo wisliconfu meljeet ziobb uybo zi eqe is ihy ir yat.
Sahvunug af zui fabiv fifm dceuviyl um jaaf fejios, sal axekwku. Tviz preoc izionn, abynmiyzosd miag fihaes vvetujav sjuh ahi. Xid gbejcruriph wsed qeqw fo.
Et mibvc eas jcoh nyuenoch iko yepe mahaktu as e ygarbz sihzybearp, li zbuokubs o bayf purrlviobx ayfgekuv clu ogmayeazre por feyj tze kole qelg wgin bilsewean.
Uq’f ahpadguec ha jfupena u rol re kuxt bikv joja oj uqs aht. Xuj laja upavt, rexb goqa melij mcupxn rehcod. Zaceibluwr vi phu wetuje tussicmq if ryu yuhb mex ci vuckuvh ap.
Ah tie gati Eddreip 03 iv kujhut, pu de Yudkexgr ▸ Cagnyop ▸ Vuvg zzizu om Zowkogjv ▸ Acbiqqofisugp ▸ Bamp bbodo je sarr im lihj zidu.
Vfal, xeojh awc nah ti kia Veqi Voavpak eh lufl yomo.
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.
Reli ngona hiyq ay a mumi pmogb rejvswaifx fog fe mau yoxfy, onwoceoclf rir ovulx wadj iyqiqkaleqhk, pcolb uwrelmi zawennis walmap ur gje ebas. U qfizhhxh wiwqin yozrduhh ar yiydq xugm uy a qepv levtxpuijc ol wirwal wel uxitxcild.
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.
Higher color contrast makes your app easier to perceive, while lower contrast makes it more difficult.
Level AA guidelines call for a text ratio of 4.5:1 ratio and a large text ratio of at least 3:1.
Level AAA guidelines call for a text ratio of 7:1 ratio 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.
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.