Skip to main content
AI in Production 2026 is now open for talk proposals.
Share insights that help teams build, scale, and maintain stronger AI systems.
items
Menu
  • About
    • Overview 
    • Join Us  
    • Community 
    • Contact 
  • Training
    • Overview 
    • Course Catalogue 
    • Public Courses 
  • Posit
    • Overview 
    • License Resale 
    • Managed Services 
    • Health Check 
  • Data Science
    • Overview 
    • Visualisation & Dashboards 
    • Open-source Data Science 
    • Data Science as a Service 
    • Gallery 
  • Engineering
    • Overview 
    • Cloud Solutions 
    • Enterprise Applications 
  • Our Work
    • Blog 
    • Case Studies 
    • R Package Validation 
    • diffify  

Theming diffify for accessibility: Part 1

Author: Tim Brock

Published: July 28, 2022

tags: r, diffify, accessibility

This is part one of our two part series

  • Part 1: Theming diffify for accessibility: Part 1 (this post)
  • Part 2: Theming diffify for accessibility: Part 2

For most web developers the switch from desktop or laptop to mobile device will be something they do most days. We know what a designed-only-for-desktop experience feels like on a mobile device and it isn’t great. But accessibility on the web isn’t just about checking that your website is largely agnostic to the physical size of your users’ screens, it’s also about making your content available to those users who have physiological impairments. For those of us fortunate enough to have close-to-normal vision (perhaps after correction) and good fine-motor-control it’s easy to forget that others do not.

In this blog post and a follow up I’m going to describe why and how we used theming to make diffify.com more accessible to users who suffer from some common visual impairments. Here in Part 1 I’ll cover some of the science and the terminology. Part 2 will look at the actual changes we made.

Do you require help building a Shiny app? Would you like someone to take over the maintenance burden? If so, check out our Shiny and Dash services.

Impaired contrast sensitivity

Contrast sensitivity is a measure of our ability to distinguish between foreground and background objects of differing luminance. Correspondingly, people with low/impaired contrast sensitivity may struggle when the difference in luminance between foreground and background objects is small. In our particular case we’re talking about foreground text on a solid-colour background.

Impaired contrast sensitivity is associated with a number of physiological conditions. Some of these seemed obvious to me - cataracts, glaucoma, macular degeneration. Others less so - diabetes, Parkinson’s disease. Moreover, as highlighted by Ashley Firth (in Chapter 3 of his excellent book “Practical Web Inclusion and Accessibility”), low-contrast text can also be a struggle for those experiencing a temporary condition such as a migraine or, simply, tiredness.

The Web Content Accessibility Guidelines (WCAG) set out some complicitly standards for contrast levels (and much much more besides). We wanted to ensure we offered an option that meets their AA standard for text.

Colour vision deficiencies and colour blindness

The terminology around colour vision deficiencies can be confusing.

People with normal colour vision have three types of functioning colour-sensitive cells in their eyes and are said to be “trichromats” (from the Greek “tri” => three and “chroma” => colour). Those cells are called “cones” and have different wavelength peak sensitivities. These are sometimes referred to as “red”, “green” and “blue” cones, but more accurate terms are “long” (“L”), “medium” (“M”) and “short” (“S”) in reference to those wavelengths. The chart below (from the Wikipedia article on cone cells) shows that the peak sensitivity of the L cone cells is actually in the yellow part of the visible spectrum, not the red.

A line graph showing the normalised responses of the three types of cone cell as a function of the wavelength of incident light. An underlay shows the visible spectrum itself, going from blue to red The peak sensitivity of the L cone is actually in the yellow part of the spectrum.

Some people only have two types of functional cones. Correspondingly they are called “dichromats”. People lacking functional L cones are “protanopes” while those lacking functional M cones are “deuteranopes” and those without functional S cones are “tritanopes”.

Alongside true dichromacy there is also “anomalous trichromacy”. Anomalous trichromats have three functional types of cones, but one type does not function as expected. These three conditions are then referred to as “protoanomaly”, “deuteranomaly” and “tritanomaly”.

Collectively, suffererers from these conditions are often said to be “colour blind”. However, all sufferers can see colour so this is something of a misnomer. Nevertheless, “protans” (those who suffer from protanopia or protoanomaly) and “deutans” (deuteranopia or deuteranomaly) are often said to have red-green colour blindness while “tritans” (tritanopia or tritanomaly) may be said to have blue-yellow colour blindness.

Collectively, the groups that are said to exhibit red-green colour blindness are much larger than the groups said to exhibit blue-yellow colour blindness. But it’s important to stress that this does not mean we simply avoid pairing two colours we semantically refer to as “red” and “green” together. It’s more complicated than that: Trichromats see colour in a three-dimensional space, dichromats see colour in a two-dimensional space and the names we give to colours occupy a somewhat fuzzy, somewhat discrete space.

The image below shows a screenshot of the Functions section of diffify for the {ggplot2} package using the default theme that most users will see when they visit the site for the first time. Overlaid on the bottom-left half of the image is a simulation (we used Sim Daltonism, more on that in Part 2) of how the screenshot would appear to a user with deuteranopia.

A screenshot of a section from diffify using the default theme. The top-right half of the image assumes normal vision. The bottom-left half of the image applies a deuternopia filter using the Sim Daltonism software.

The simulation suggests that deuteranopes might struggle to see the difference between the colours used for “Added” and “Removed” buttons and entries. There is additional encoding with the plus and minus symbols, but we wanted to offer something better.

Other, more extreme, colour vision deficiencies exist including several forms of “monochromacy”. “Monochromats” can only distinguish colours through their brightness. These conditions (where the term “colour blind” is, perhaps, more appropriate) are very rare and so won’t be covered further here.

Coming Up

In Part 2 I’ll cover what theming is, how we used it to improve diffify and the tools we used to help us test our improvements.

Of course we aren’t claiming we’ve got everything right. If you think there’s anything we missed or just got wrong, please do let us know by raising an issue in the diffify github repository.


Jumping Rivers Logo

Recent Posts

  • Start 2026 Ahead of the Curve: Boost Your Career with Jumping Rivers Training 
  • Should I Use Figma Design for Dashboard Prototyping? 
  • Announcing AI in Production 2026: A New Conference for AI and ML Practitioners 
  • Elevate Your Skills and Boost Your Career – Free Jumping Rivers Webinar on 20th November! 
  • Get Involved in the Data Science Community at our Free Meetups 
  • Polars and Pandas - Working with the Data-Frame 
  • Highlights from Shiny in Production (2025) 
  • Elevate Your Data Skills with Jumping Rivers Training 
  • Creating a Python Package with Poetry for Beginners Part2 
  • What's new for Python in 2025? 

Top Tags

  • R (236) 
  • Rbloggers (182) 
  • Pybloggers (89) 
  • Python (89) 
  • Shiny (63) 
  • Events (26) 
  • Training (23) 
  • Machine Learning (22) 
  • Conferences (20) 
  • Tidyverse (17) 
  • Statistics (14) 
  • Packages (13) 

Authors

  • Amieroh Abrahams 
  • Aida Gjoka 
  • Tim Brock 
  • Shane Halloran 
  • Theo Roe 
  • Colin Gillespie 
  • Russ Hyde 
  • Gigi Kenneth 
  • Osheen MacOscar 
  • Sebastian Mellor 
  • Myles Mitchell 
  • Keith Newman 
  • Pedro Silva 

Keep Updated

Like data science? R? Python? Stan? Then you’ll love the Jumping Rivers newsletter. The perks of being part of the Jumping Rivers family are:

  • Be the first to know about our latest courses and conferences.
  • Get discounts on the latest courses.
  • Read news on the latest techniques with the Jumping Rivers blog.

We keep your data secure and will never share your details. By subscribing, you agree to our privacy policy.

Follow Us

  • GitHub
  • Bluesky
  • LinkedIn
  • YouTube
  • Eventbrite

Find Us

The Catalyst Newcastle Helix Newcastle, NE4 5TG
Get directions

Contact Us

  • hello@jumpingrivers.com
  • + 44(0) 191 432 4340

Newsletter

Sign up

Events

  • North East Data Scientists Meetup
  • Leeds Data Science Meetup
  • Shiny in Production
British Assessment Bureau, UKAS Certified logo for ISO 9001 - Quality management British Assessment Bureau, UKAS Certified logo for ISO 27001 - Information security management Cyber Essentials Certified Plus badge
  • Privacy Notice
  • |
  • Booking Terms

©2016 - present. Jumping Rivers Ltd