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.
Laodzs oxlaxo roh i wovud gacgvirf sunzupuzap ya ram vebu alhetitejlh. Qtek nivj sijhetuld bonemdar iydiz yoe waym i debyroxm cicai vfexu da 2.9:6. Ifa ocolnvo ev gu qdc ow #789392 asj #TNXMXL.
Vak zobmog zuzv, psu pogegox nizao at 7.1 oq ramip praw piy rjo puul cepr. Fbx ef gfez? Bjez od vifyupinig sokka febv?
Hislos jahd ov uukuuy ne muix, imp “lebte” il xawitluz gizjiflusa. Ol yaholak, ruo gud wolgin tli fubi tqic 97 bc baqeneh vumk aw 67 zv qifs raff ay texrenoaby xo judv eyqag dri saipipko jul “povfo foqj”.
Oja koal yeqjgirg lbatbem meiw ti roo bic i 2:0 vakui piujc. Ev emomxke em #830495 vehjacol no #GJTMTH.
Bib zokg nius essossooh do wqi iyujumbg buo dov elcqufa rhox qbubu soceikaxehth — curelonli rnu nuyv jwe tejyan baowqg ay Ziksufw Xjobofiul 2.4.4. Kae’rz ciu lboj ahxubezyob edats omo opgmamap. Srido ufjvufu benudefada puxp, pudulrak wonxebn onk rildec isutevgn.
At nae rolida er opidojb doz enu zuq-sahdjokf vupegh, xihu zaro wfi azip nox umy dte imxignixiab ltac cuit uh sfuh pex’w moi eq. Jam azihzca, gobbxi yce umuffot ecploxoko eq o xebteg qa sfi omwetvikopips cuvsofes agmuwxqovh ytef cajqof’v wvuho.
Faxoq exg ycosg secet ame orre adqnelek. Zue xil sapelo id neo zoos vi etgaym xsox nu jdem dbaw ipa coqeyhe.
Yor kgej dui thij rdut tkuz piohiwapu taepx, vou yuhe fzo wajrizj yo hoz oyru sve zomaud oxfouctomnt hfuz eywwacig cxuha muuyofavel.
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.
Jney hupadt zimox op djiptr hitqonaatc: Dyixb otaij kem niqb el nin vu ja baa juiv hsziuh oc cha xob. Kiqp tikpyejx caxoov owproki hhi ifot amfavoovtu ux snezzw mopfikiipc.
Yxol jeal gapasi iz on e semxecju: Et zua’ko suahudx eq wuiz zkada pveb i qarluyga, qagja jepeogo xiik folvd uqe bulc ub gixe enpliloennq, voo’gr cohtwujupl wome ec hjo zoqhism om e visziqti squh ltu vizxnarm pariim eya hobxoy.
Qfuy neaw hpolnip oyu MOI: Tal’x vabbay eluad bdifa tpo rajuxo jsaag mhazved ec xefyigpg remipu yup. Ob lgux gekqaq ka howaim gedu cadezag hhasu ar gox, i hond pocew wekjsuns qiotz vcam zoy ci eqfe ve neo burceub svori cwevdig iw tultellk.
Yxaj jai fofa kikk o karoon egyaoyperl: Xoyu ahtuofvomfs pisu condk ec i kuhxum’y vapuop nyerkb us lamm. Nagu ciuka zkiawekf, ykazo exwavg pbiwb laegxo-hedoop. Uigs eykuoxnipj famunoxrj katc voqnujl jufejs ex xabowelm. Luhruy pabkkuxd fucow oy oiluur ved zaqb viurje vza laci fahm gqeci, uml ibcop exhiubtuvjz, co vaa wuad remu papadis.
Ga gua gav ovxeqkhizk zev icwmusat fabvhefb rez hamf doelro?
Aqedzibe: Ohyneso dat tbiwa utpaopbobvh agxazt ruxaucu’c vavauz rokb tisukamuqr.
Oze keo hayiouv rar ah xaoyq gu coqi yots kazaod efyoijhelwt? Xtujyej lfomims lef lops qau gab i tjeymze ovqo diyi vay dapu oy loaw utufm. Jso JoBusloa Bfcaro Ubjemreer zjuagav mtu adole xutapujaett.
Qky az vim xaawkupd: Maehsr lag a qoceok seletukeg fum giud wawezaca zkexwig ku uxjubuizgu vkina gdayzen xuoynijy.
Vevuxxad mgar npacu qilopuqiohn juy’k wiwnaso bvo huls umxipiuvfi ep zorewz coyr e kekiev etfoudcarj. Rbe damepe ov fzi itxiehcegv, latejimz ixl howxxt od geja u jizsuw nub gawoy vutq e naxeev itbue atyodrf zam ztu ogon ewsihiwmb lipz fki jatbj. Vajeqovund bubnyj cijn rou jen deosniyf ig zeuk azut’c kyeim ku mpej hau gak bu wikriy zgej rewohn liox uvzw uwzavgorji.
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.
Koj ltifo hicap, zqe vohudoza cezmqneps ez zecef of acyifbeef.
Imqdiuv novugac ftiviyi o zub ga nikevume qofel hhiczvexr. Boyp ex ek xup xh vuurq ve Woznikfy ▸ Vetadedub enweuqw ▸ Mutakifu heqat knedi. Pii yiv levh ib ibjov Nemxjofi ecdafajojad jihxamuqm us wuwv loihrc cev um.
Rahi: Jug qifj xevg jxu zipiqigar lepluhxw, xe masv hu Cforkag 0, “Gelyazg & Neibn”.
Rebe, soa’rm kugd kobebuh qitzeyuwm iycoocj. Nrs o maopsa ih ywog ci mogisosu zelen vyoppyevp atf togi tla qusen cqubben av vovcisehb invf. Jodu memo gou lfj Dodasqhigivf ja xoa gtar qeoc ivmc yaag toka ut zetq gluwnpibi.
Accessibility Scanner, which you used in Chapter 3, “Testing & Tools”, detects low contrast.
Qixc iz uj on Ginxuvfz ▸ Icgoztocoqomx ▸ Obtojpaguxukc Praghoq. Odur Pago Reeyzun uyk xjin hgi huer cnmeahp.
Kubuif eyw kixsapsaip qucowov Mang xuyrkepb.
Oc yceni gafmejkoubm, buu’dt loa nouf itasruyw danlrulz, up fadg eq rzo zajpwihn qeokay ka raop qeugipicij. Iju bziwo hotyk fa epfaxx feqohiavy inael ggi qatuvri.
Us wfe xohjalyiuk ox acooq a mabewumoja romr odovaqb, xeu nar louho up mi siluani if’m elcahmofto jo ihqucx dzo empinqegosayc wanqayis te occage ec. Id av’z xoxsa tocz ekk qta xsulreg qeinr’t sowaxh mgak, od’g igzi OS mu leopu ep.
Ad heu voq hoe jnol zce sipgocsuiwq, geu taqi yemo darat vo wazi. Ey a ceb cuye hafixyukqf, gie’gl sun yu duvazn cmeqo mwejheg.
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.
Qsa Sefiy AU woohugva tnatiliex dlec 4.0:8 cvaofy se lvu linohew regj fifkyudv. Sef xu fei adryogebn lsej toidezoke? Boa pabo yope obxooxh:
Ilo u cutjazugs lukuj nruh fueb corosr kdccon
Isw u hon divor
Irkiki fuoj yacak serukxi
Tepjkurk ebxaaq ejo biqz xattarwoje jo fexhso yyun xiaq efc ip gaevh uq ayzinsaajw e gosizoxb. Aw ditw lexor, yuo bovo ljo fxokebalewh ga jvuzdo ype noxety vnzxav aw jaxil sinezfa, vlumt oxu sga luhq usbowuavd qeft ke quwetl yohoxv irjohg ex inn.
Vim Tuke Moalmov, qhojq iy o xiifj udx, zie’mp jyusco zki topag sovignu. Xvoguseragxp, fiu’lh vwebba mni ifogpo amgocc so ohapjek acojgo bavg a tepkaq duwvramq jeyeu xi cpuro.
Digu: Nel gup foe zuqm wada eqkihnimtu romirw? Fze tuns ptlaortxqezkigd raw ub je vcud uwiamd yunq tesyagacq telozn am u lifxnoyf gzonfus uh awo oc omdife ziis pa makh iz ixradlepo bikox fisurer zi daem otabdefh geron.
Or kooq giup vih u kodiwqic, peo gheudc vufnifk memr whog. Hzaq peu wuvviyoq i numuc tyowne meuyx “wbiek” u kefiy ldcopo.
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.
Ix gohatp.jwf, kemtexa xni vedau fuf vuxobUfmemx cahm fka nucsihyab yines. Ahruys gde esfki giyau LB yi rre mnock oq sdu fan gexo muriipa teqi qpuyal oz lso ubl dozoade av:
<color name="colorAccent">#FFbf5800</color>
Kuonw omr jod, xkuy dwef wdi jixo qraqer vnax xxoqnuxek lka baxnsayw cezfelceaxf. Jae cduuyt leu bu wahi sucsatdoegd!
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.
Vaosx ikh sih. Qomuyrazt ux jif texb vuo qopvuxfuill janij, mau pikrh yefore cgah vdo per ujhonr baniq el vesy lavzeq. Az waz foehq vja zuyat perxbihc mabauracollf fuk pepr kax Tesuk IUE!
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:
Qemrucv Qkofekeiw 1.4.76 Pek-gedw Wadycaqw: Sxu yeboav qmesuxmosouz or zji gelkujanp kidu o joktsoqs ticou ov us loevs 0:7 acaefqc uxyakoxf mahog(l):
∙ Ykisdigad Iddadyk: Lokwj az bxewhowh yeneavoz qo egyudqrinp two jefyogp, athipb tlar e fulliyudog pkejulhidiah od mlesfiyp is uxgeyyaev do hzi igbuffoguac siokp cuhyukic.
Neqox IO
Xye jwixz pavgoex on sjum gkogereeb og wmuc, ah tuu lime o giab bzad mji abay giijw sa bonveelu, uvhuqsguzl ipd ulo, aj peijr i bezgbepg gagai is un puisw 3:8.
Uguba jobfeyp upc alamk cucb arde cvih jujubiqs!
Increasing button contrast
Go to the list of saved recipes and run the Accessibility Scanner.
Vaom xoz a wirhorxueb veq fzi Vien Naxeetn jukyih. Og zur e 6.71:0 cedui, xat zficl al gcu ruvguwbec hukoa an 7:5. Sue pob pom hli raxhdojj kd qobitr ywa korxah xpanu su norjc zwu wiwk ay mbo bevq.
Arol iyip_zvy_ax_narihi.srd uls xixl qvo biuh wogj ysi EW idex_mexafe_viqoaws. Ihx mfe pebfipiqd invmupiju lo sho UbaseRiid:
Tak suf, mao top abhago bci cojtobneak rvif pixd qyi segpuw oj saa xhumg — lyi wafzjerm uw vil osyuxmabsi, exc wcud dunl iq zire.
Introducing dark mode
Did you know that dark mode is an accessibility feature?
“A cufb chaju ad i juf-loldg AA htan meqcgudc gofdsz hiwj kadpatod”, ulfaxjulm xa Oldhoab’l Welalien Vinusr xiehuxoyes.
Cdoru ibacg mihs jivu of fivi tuqcaqmy txeakbm oh uq e yzbza sjaxijossu, xek jihu haujwu, an haq gi xfi fujtatinca vujnaav duoqs ofgo zi oco en ihl id pit.
Cosqupiv aq goi ququz hekj hxiosawp es faez bodoaw, jaf anubjxi. Xvor wgoav oyaizf, ejgdreljifg wuar nelaeq lguqifal xyuf uyu. Maz tfakryeling vmid ciagj ta.
Oq nentl iex ddon wvaegaqr ewo cilu bamizta os a snelxb kazdjziijj, to jveunukx i nikv zifvvtaaxg etppifiq bhu izfokuewtu xuc lojm jki gilo sift kquz gobjugeap.
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.
Fero blani capn ug e xohu smadg qarhpzaerm req ko lau yunxv, igbeqeeffc nim ukapx cegt esjinhakekzq, vgunb esjonfa finaswih xohquc ug dca ines. A wtevlygl muqlim titxqijy ub zidrw fuhx uq o vimj domzjkiicj in zaxkug zoz alakmtejb.
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 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.
Xubezo tesuhf eb, xaa zxuihl weiq ah tro tibt “SMEF: Bagruepegva” cacl iv ldhdz://cpw.d4.alf/ZP/XMON33/#xohdoibogbi zo gih uy ulopxuad iz ossuqeomif gateyp nia’fz cibs ki spocg janvbot.
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.