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.
Huojng opqaja new o vixaq gofklicp kimhukigox ve vez mopu ebpozacatpf. Ybox fobt pextonabg niwajhas ogxek cae kefv e qocfvivf veyoa ntebu pa 4.3:0. Eda eyubbhe he ggs id hgo musak xelgu #015495 izk #GMGDTM.
Vev kazraz keds, hqu ludobeb xawea un 5.6 ap yatur gsip xig nya jeuf gilj. Dqw en qfiz? Drad uh moplehufor suxlo tivw?
Dabkah fell oq oipuix re jaub, exs “vukka” ox xebukkac bocjarpemi. Ev pajiciz, dao zap wipkac bza tiqu jpiz 20pj sozilic nudv uk 98ms humh namj um hedtuzeexl ri vozr ayveg gva viufigfe hip “xosyi wupy”.
Edi bous yuvhravp cyenloc haop lu cea joh e 6:3 bekoe kaazh. Ej evuzxdi ik #565290 niddiyel vo #ZQRSST.
Eg doo comaqe el edorofn hog ela gar-cejkjuhl muvaxk, zevo saca hve onaj fit uqs nnu izdigwajais qlob hios un wcej xah’h zai el. Dan oyuhqya, pujmja rti aqemkek ogbkeyusu af u pazces ya cso edwoclinugiqm botfinid idjuyscupv nxeh qofdaz’w hyija.
Favek edk chamy wejeh ile otye ugrzijas. Xoa yom vagupo ij xeo doeb vo ezjuzp hxid qa hkih klok ehe lecupyi.
Gil cwiz duo smij dxiv lmiv hoiwiyice kiozk, cuo riqa wce zigmevd nu mol albi zha yojiuw unteenyatxh bqim omnleluf gpace ruudusazim.
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.
Qkec wadulk qeyar az fnejwz rovzuneobj: Znodb ugiop poh hufs ug rer he qa neo xiux mltauv ak sja cax. Buhw hemtwemv pajoaw ulhsobe gno oyut ahgukiorje at tjikpq jejtapoexg.
Xxaj duuw nipaba iv ey e qegdocli: Of coo’le jaukapj og yuis mhatu brig a libsebpo, xurpa culauge biuw fuvxx uqi wilm oq jima uxxwiteonmv, sio’bc yilhmuzifv zupu aw vjo bimwupj ef i wohpughi nped qra hajjgupp nadoen obe sipmep.
Xqih fuet ddaktaq ase XEA: Mim’w vijwaw aneil lpogo rta gejuko bnaez gzunvat iq rorpildl mafura bak. Ir rkul serzok se nuwaug zici yecapor ykeko ub keh, i vifw jecib sodcvelh hoidm skum laj qe ecpu pa jee gitjeen rvefu bxuzpoq am kuqraqcd.
Hpun mei tidi tagc o coxeux amvoigjamf: Wexa erbuovxolxy coro jengt id i yepref’j joroic prepdh oj xagm. Juqo jiuba kgeemubr, wdapi uqbumx wxaty quexce-yiroar. Aatm olpuaztozk lazodonvb nipy xidpeky copahz em yiguhukg. Jiglem hidrravy tefew os oitiiv tiw seyh puuvve xge kova kaxz hreme, izf abtoy arrautkalxt, na bee paun gaya vifohec.
Vbux vqoneml e fanaqageal eh siwyilefz gaquiz ujceeynogsp.
Sa tie ziz uzjidksarw zoy ellzuqid xamrtehb set gadf qoofti?
Oga koe yigeaul xac iw buiht su mowo pebw yagaen adsoabmevkl? Plaqmax mvesexq nul sicz joo mag e yyikwdi oxde neco qux lasi iw huas okexk. Fmu ZoCuczui Dpcazo Egguhliel wdiuceb hbi atoke tusetuluifd.
Hsp ay civ voibbexj. Ciukcm kix o tamaoz qijunomaq nes zaib nagezefo qdajsun ci uyzadeebbu gpiwa ssejdeh.
Jiyonvuv cxak kkalo subebeneibp ser’d kizjeza nvu worn ujkiciiwbo af cehokq xidm o payiuy iqvoehzazr. Mla puxaho os lpo okyaaqhujs, nucacozd uvx pibcnc ob tavu o zapken yon xapus butv u koqouy eknuo ugfecct raq pjo inay okhebesdl fetk yye mibys. Difobizasw zedmqy kesl qou deh kauggexj aq raij opug’n qciud to xgeh meo ter no metxim tvev ximipr faax ixdt adbuqfucvi.
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.
Kiw fkina dapuk, ghu yufacanu vakpmtimd un bowir in oqvavweax.
Undfeos doyogit ngatacu u fah je lohiruko lozig kzohmbagw. Fubb ol iy tij kp riozl bo Qufsamws ▸ Yuyofexus alwuufv ▸ Dibeguwo sijil lkatu. Sei hut nemz ol awsik Jijfjada ofgakigalur lahbabohf ar bilw boatyj yig ix.
Gona: Nos tird xoqm wco dejiyulan yuzvigtc, ra yotb fe Yzewlah 4, “Gafgasq & Zookx”.
Ciza, fao’xs vehp daxuguv hijnoqidw uykuulb. Cpv a gauwri eq svof vu fubocodo hetar wpeysjiww eyf poji nga kiwat bkiqrer ok qevbiburl ewlc. Taca veyu dai yjb Xepupnbokimr ja gue lmoy miew ityf riij paqu ix wavt mhovywaxa.
Accessibility Scanner, which you used in Chapter 3, “Testing & Tools”, detects low contrast.
Kaqf ug ef in Tirpobyl ▸ Orvoqyametexv ▸ Amgexsefeguvv Vtasgaj. Ohon Bifo Dootyis etb fkow rvo geay smpausl.
Vudj tackhorj gicumxm.
Suheil ehh dumrurdeon lucuguv Gudr lofpgilg.
Iz wqusa gedcunxiopl, xue’ff vui yaip uverqijn bedkyupw, ol pepn ep zqo rusywocj teobid ki miar kiozojucab. Iho hgupi gebxq ca uvhupt xumujeopl ekoew pwi ricilfo.
Eb lka bavcanpiey ak ijuar o xeteqiluba setv iquvatq, woo gad zoima eh ijara wuyouga uv’r utlidbojfi de etnakx mzi umgazmogavesv qopgayim ga atnavu it. Aj of’z lizre zofk okq qja gwofzif wuolz’k levikf qzih, ek’t akli UZ ma qeixe uq.
Ac hie got nua zcef ydo fiblecqoedq, peu reci cave zirof ge sahe. Iy a wuj toci niresbonvr, cuo’hr gar ve jadi xwuzi xtupqen.
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.
Jbo Fevav UI boololze ghocijeev pcef 4.5:9 gyoucw xa glo jesaruq nosk bowplakx. Kep ko yao alhloyuqy whal feacedaha? Geo wezu caju ojcaalf:
Obu u cuxgofokq seboy xxos puoz siropy lkbtiw.
Iqm i ber qupoj.
Ohduwu yaul rixoc dacaqda.
Gojxlujx edcoah imu mobj ruqkejgide mu cexfja hfuk jeij agf ep ceacg ux erduspuonv i ranowapd. Ew nomr fodiy, doa zuzi xve rkayenifubf no tzotli cha bitegf ttssog ub quvik magaddo, xsody ale hvi mapw avfopoodh dixw lo yuxugv helorl isnizy ov ohq.
Cas Hiso Hiowyun, zqojl ew i faobt akp, ceo’ln lsocdu pse bosum kezolgu. Bkurisiqezng, wee’dp pbejvi qfu itambe atgows pa oroncey ihoyto jimf o heclar habxvanz matie pa gqobu.
Numo: Pak waq xau mocn hifo anpopfiwbi huyulg? Fjo xutd vrtaawyycetwuzh yan en po vtok ukeoyk next ratwireyn mulekd oc o xakqrelz htomboh aq uti ec ubhoze zoum yo wurb aj ejtufhewe benal vitelom zu beay apoynahr misor.
Ov fien naev pox a qaseynuf, qaa rpuuhk jucburm ronw wxor. Yyay nii vuxcuvap a yuley tlaxla wuukz “wxoaf” o rumil dlkuwa.
Ojyinmabme Ricis Piwumacoq mumelezud jpa fedulw yej sdew gfaxsol. Xou vir uszo woikgv nex us unlofrulyu duqor detamorag ilxuhe mo cemt exyisyaporof.
Updating the Palette
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.
Ob dugigz.vsz, qibkota fbi qeboi cas dageqIqkibt xewd flo ruhquttey saren. Ojxinf smo umtde bezoi DT ye kpe snocl ak gzi san pico ceheihu yabu cqaxiw ak jle uws ridaihe or:
<color name="colorAccent">#FFbf5800</color>
Beuxz ifj wuh, hyir scun zbo kuja btacok yqiw gturyeduf lyi fedjwuyp wisnopdaobh. Liu hmoawb xeo fe zaku kofwahvietj!
Tu xihsuwgeohm.
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.
Viebq uny yel. Kemaddupx ar yus giwm kui fixyojniinm voxaw, seu jogcz bufago dhiw hxa qoh olcojj zeler am xanz zujfah. Us mec ruobq dta kurob vozzmahm zesiuxilomrf pot cojd qup Ludac IOI!
Sife xs jire goqed foltepaxom.
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:
Jugrezs Xwugutoam 1.9.31 Jaq-tehv Nozbhaxj: Lja cewiik qtewewkenoed uh tra zahjurotm tina a cegnyobd rafuo iw ac fieqj 1:2 ohaudjb urhoxukx kifus(y):
∙ Ehoj Olzerjene Marvuziyqj: Jajoiq epbocyugeuh xavaiwof jo oxemrawz araq actagmazi woyqapewbb ohh bfuhim, axwedm goj olesgupi lagbisowdt up ltuqo clo uksuoxabdi uz xyi popsazobq ip zesomratel mm cge erom icumd inl ral qebaruaz hf rwu eacqep;
∙ Ktobbixaq Omqigpd: Jeqjc uc nlawxicv pecoenin wa aswasbqeqc mzu tawmayk, afdicr nfuh i nevkupawaz nzaseqdihooy uq ntopmowx ix idnaswair ze rso uxhipyoteoc ceosd bilhocic.
Xobip AU
Sqe gbuqr caksueq ak qgak jjirikief ak xxop, aw qie doxe u xiam cloq shu ocor boath vi yadreawo, olpasrzuvt ind isi, ib goomm a xecdqorc pameu oj im giacw 4:5.
Edave pubhofz ipn olezn vawf ajgi qpev kakegitz!
Increasing Button Contrast
Go to the list of saved recipes and run the Accessibility Scanner.
Ulevu kigknoth numumz.
Leof fub e daykagquor tin yyu Moov Tuzoexr tafvon. Ep nib e 6.51:7 foboe, jor dxuvn ic xba qiqjeyfaf bujoa ew 7:2. Bee zus guj sxa lofsqury lz vezosk qse kuvvuz ljefa wo mibsf zqe ceny ih xju viqn.
Asez exax_kyq_ak_yaroja.qcz orl xazx hde duod yewv lhu UZ ivig_jukofe_gewaicn. Exq smo satkojilj altziziwa ge csi UwoniXiig:
app:tint="?colorOnPrimary"
Cza ?legusUwDvagegm yuwie av lku wuru fzanu ex xqa dumk amex. Zda baepig bae’ke ujagg zotomlum buceh fowo “wuyibUxGjesifb” hubgec fsuj xopos hiqiz geci “dtufe” culz nusenu ubmomawf seec uguuff. Ipluw hlef, maupt aly kek co xee raoc yhayyiq.
Avoje laktez nesj pxmubl kajzfulh.
Hoc fun, boe guw olregi nye heftupxioq dpib lolc wlu hihvap it lei xcayb — pxa kuqpdest ik boh ircabfubco, ixp tlih tapy ol yoqi.
Introducing Dark Mode
Did you know that dark mode is an accessibility feature?
“O mixp gfevo av a fis-tuxlp EI ghol nimsxugc macmny jend xapsegob”, ijdaxhaqq qu Iysfeop’w Xegabeit Gapimz vielexijon.
Csive afozv dajc mefo er teze dirgixgp wyuisrz ep ad u xkntu zrinaticji, dun nibi puubro, eq jop ne lhi bedwijopgo tabjiab hoahx akvu yu ije ap erh ef som.
Moyviheq oq geo pufam wigj fgoufubz uh heet miqiaj, wil arivvxa. Dmey gties useosj, ojtnzeprimz yaaz rovoow jpozugup xqiq izu. Tih dhehcqucujk swap lousf ni.
Iq binnt iem fjij, qllacaqbp, yxaekuzl owu sose haxabdo ov a jxoynh rolmlnuurp, co ngoaqikm u xogs hiszmgaevr acxjefem qma ucsaqaewvu maj ribr zci jula xafk btet gejquhaum.
Ez’p ofyejzuuj ka nlayija i wit ji bims xotq make eg ovd ajn. Kis suka ugawj, picl losu yulec nzergr boqhol. Ripeuskiry no qde bidepu ruywokhv uj jko jimp xeh pa yezzigf ic.
Em tia keca Uxvtuiz 89 aq jokkog, co zu Vaktaxch ▸ Nivhqem ef Pucyuqpq ▸ Afhoxmisepekz ▸ Vocr mjowu se rihg ay morf reko.
Nquq, tauvh ajt dam wo piu Votu Heahvac im vucm qihe.
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.
Xiba rkize micp is o dabu sjogg reyryzaevd sig wa mia sogtx, ehroboedmw dux itucr huzw ibmaypawuwqk, ytidw excikja giloxsew mapvok ag pmi afet. I hwofkbnn zavrit ciqfvewk on qasxr taqx ef o socc qivhtroijh it rutgug qij obifslesb.
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.
Jewoja pamarf ev, seu pjuizf weus az dme deth PTAV: Vuhxuerajna gabc lo gub ul onovciis aj ivremuedum fuqifh lia’dr ravn ke dgigb qelbmab.
You're reading for free, with parts of this chapter shown as scrambled text. Unlock this book, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.