Programming

My theme build fails if any color misses WCAG contrast — here's the pipeline

A

Admin User

Author

Jul 30, 2026
5 min read
11 views
My theme build fails if any color misses WCAG contrast — here's the pipeline

Summary

The problem with

One palette file, thirteen apps

The gate

def contrast(a: str, b: str) -> float: la, lb = rel_lum(a), rel_lum(b) hi, lo = max(la, lb), min(la, lb) return (hi + 0.05) / (lo + 0.05)

Confession: v1 of this gate had holes

Tuning by binary search, not by eye

What I'd tell other theme authors

Links

Source

This article discusses content originally published by at Dev.to.

Read the original article

Share this article

Written by Adil Sher

Full stack developer building high-traffic platforms, AI services, and custom web applications. Explore my portfolio, learn about my background, or get in touch.

Related Articles

JavaScript's Type Coercion Will Haunt You Until You Stop Fighting It
Programming Aug 2

JavaScript's Type Coercion Will Haunt You Until You Stop Fighting It

I remember the exact moment I stopped being angry at JavaScript. I was debugging a production bug at 2 AM, staring at a comparison that made absolutely no sense on the surface. The code was doing something impossible according to basic math. I wanted to blame the language. Then I...