◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SONNET 4.5 — Retires on the Claude API on 11/30, 26 days left. If your app calls it, check the migration target●SDK 58 — Moves to React Native 0.88. R8 is now on by default in Android release builds, and iOS prebuild generates a SceneDelegate●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SONNET 4.5 — Retires on the Claude API on 11/30, 26 days left. If your app calls it, check the migration target●SDK 58 — Moves to React Native 0.88. R8 is now on by default in Android release builds, and iOS prebuild generates a SceneDelegate●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
Articles/App Dev
◇ App Dev/2026-08-06Advanced

Deciding overlay text legibility at ingest time instead of on device — four metrics measured side by side

Moving the question of whether text stays readable over a wallpaper out of the device and into the content pipeline. Four candidate metrics measured across 240 images, including what downscaled judging actually computes.

Rork612Expo234React Native243Image ProcessingAccessibility4Content Pipeline

✦ Premium Article

A night-sky wallpaper opened, and there was a faint dark band across the top of the screen. The image is almost entirely black, with a handful of stars. The white clock would have been perfectly readable without any help. The band was there anyway.

I run a wallpaper app as a solo developer, and one screen overlays a clock and a title on top of the image. To protect readability I had been laying down a uniform rgba(0,0,0,0.35) gradient across the top. A conservative choice.

Conservative and correct are not the same thing. The night sky was being dimmed for nothing. Meanwhile, on pale pastel images, 0.35 was not enough — the white text smeared into the background. A single fixed value was wrong in both directions.

So decide per image. The hard part turned out to be the question underneath: what exactly determines whether text is readable? I built a 240-image corpus and worked through four candidate metrics in order. The short version is that the method I ended up with removed the scrim entirely for 189 of the 240 images.

Moving the decision from the device to the pipeline

The first choice was where the computation should run.

Analyzing pixels on device came off the table quickly. There are thousands of wallpapers, and they scroll past continuously. Reading pixels on every display spends the rendering budget exactly where I least want to spend it. Worse, the same image can produce different answers on different devices.

What I settled on: compute once at ingest, write the result into the catalog as plain numbers. The app never touches image data. It reads a style and a scrim value from JSON and applies them.

Where the decision runsCost at display timeConsistencyCost to redo
On device, every displayPaid every timeVaries by device and OSNone
On device, cached after first runFirst display onlyVaries when cache is evictedNone
At ingest (what I chose)ZeroFully pinnedRecompute and redeploy

Only the last column gets worse. Change the logic and every asset needs reprocessing, plus a catalog redeploy. As long as a few thousand images can be processed quickly, that cost stays manageable. I measured the actual throughput further down.

Mean brightness fails on color

The first version was the most obvious thing I could write. Crop the top 12% band where the UI sits, take the plain RGB average, and use white text if it comes out below 0.5.

I ran that across 240 images and compared it against the 95th percentile of relative luminance computed at full resolution. They agreed on 120 images.

120 out of 240. That is a coin flip.

The breakdown made the cause obvious. Forty green foliage images, forty sunsets, forty mid-tone textures. All three are regions where (R+G+B)/3 does not track how the eye responds.

WCAG relative luminance linearizes the sRGB values first, then weights green at 0.7152, red at 0.2126, and blue at 0.0722. Green contributes almost ten times what blue does. A plain average flattens that away.

import numpy as np
 
def relative_luminance(rgb: np.ndarray) -> np.ndarray:
    """sRGB (uint8 or float) to WCAG 2.x relative luminance.
    Linearize first, then weight. Never use a plain channel average."""
    c = rgb.astype(np.float64) / 255.0
    lin = np.where(c <= 0.04045, c / 12.92, ((c + 0.055) / 1.055) ** 2.4)
    return 0.2126 * lin[..., 0] + 0.7152 * lin[..., 1] + 0.0722 * lin[..., 2]

Swapping in this function and rerunning the same decision on mean relative luminance moved agreement to 200 images. All eighty sunset and mid-tone errors disappeared.

Forty foliage images remained. Those were not a color problem.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Measured disagreement counts across 240 images for three families of metrics: mean brightness, percentiles, and windowed means
✦What judging on a downscaled thumbnail actually computes, measured against the full-resolution alternatives
✦How many images a uniform scrim was darkening for no reason, and the reduction after switching to per-image text color
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◇ App Dev2026-08-16
My chart broke on day one, not at scale
A line chart that vanished for anyone with only a few days of data. The cause was a zero-height Y axis turning coordinates into NaN. Here is the measured behavior and the small normalization layer that fixed it.
◇ App Dev2026-10-28
"Project is incompatible with this version of Expo Go": Three Places to Check Before Blaming Your Project
When Expo Go says your project needs a newer Expo Go, there are three things to compare before you delete node_modules: the project's SDK, the SDK the app supports, and, on Android, a real mix-up in Expo Go 56.0.1. Here is the order I check them in.
◇ App Dev2026-10-22
Expo SDK 58 With Stripe: pod install Stops, and Whether to Turn Off Precompiled Modules or Wait
useFrameworks is already dynamic, yet pod install says Stripe is static and the SDK 58 iOS build stops. The reported conditions, three ways out, and a small script to check your own project first.