Skip to content

feat: irradiation compensation for dark backgrounds#24

Merged
RostiMelk merged 4 commits intomainfrom
feat/irradiation-compensation
Feb 9, 2026
Merged

feat: irradiation compensation for dark backgrounds#24
RostiMelk merged 4 commits intomainfrom
feat/irradiation-compensation

Conversation

@RostiMelk
Copy link
Member

@RostiMelk RostiMelk commented Feb 9, 2026

Light content on dark backgrounds appears larger/bolder due to the irradiation illusion. Compensation scales by darkness × density × 0.08 — denser logos get more correction, thin wordmarks get less.

Exposes backgroundLuminance on MeasurementResult for opaque images. Transparent images are unaffected.

Usage

Automatic for opaque images with detected dark backgrounds. For transparent logos on a known dark page, opt in via backgroundColor:

<LogoSoup logos={logos} backgroundColor={[10, 10, 10]} />

Compensation is applied automatically — no additional props needed. To disable, set densityAware={false}.

References

Stacked on #23.

@RostiMelk RostiMelk force-pushed the feat/irradiation-compensation branch from 9be4eb9 to e2d8b7c Compare February 9, 2026 19:16
@vercel
Copy link

vercel bot commented Feb 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-logo-soup Ready Ready Preview, Comment Feb 9, 2026 7:37pm

Request Review

@RostiMelk RostiMelk marked this pull request as ready for review February 9, 2026 19:35
@RostiMelk RostiMelk force-pushed the feat/irradiation-compensation branch from a57b4aa to ba81b76 Compare February 9, 2026 19:37
@vercel vercel bot requested a deployment to Preview February 9, 2026 19:37 Abandoned
@RostiMelk RostiMelk changed the base branch from feat/adaptive-background-detection to main February 9, 2026 19:44
Light content on dark backgrounds appears larger due to the optical
irradiation illusion. Apply a small scale-down (up to 5%) proportional
to how dark the detected background is.

Exposes backgroundLuminance (Rec.601) on MeasurementResult for opaque
images. Transparent images are unaffected.
Scale compensation by darkness × density × 0.08 instead of flat 5%.
Denser logos get more compensation (more surface area blooms).
Thin wordmarks get less. Based on Helmholtz irradiation research.
@RostiMelk RostiMelk force-pushed the feat/irradiation-compensation branch from ba81b76 to 715acbc Compare February 9, 2026 19:45
@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Benchmark Comparison: main vs feat/irradiation-compensation

Threshold: 5%+ change, >100us absolute delta, and statistically significant (p<0.05).

Benchmark main feat/irradiation-compensation Change p-value Verdict
content detection (1 logo) 34.89 us 34.35 us -1.5% 0.786 unchanged
render pass (20 logos) 1.02 us 1.29 us +26.9% <0.001 *** unchanged
mount 20 logos (no detection) 3.08 us 3.27 us +6.2% 0.407 unchanged
mount 20 logos (defaults) 818.93 us 831.84 us +1.6% 0.221 unchanged

No regressions detected.

Feature cost breakdown

How expensive are individual features? Measured on this run's HEAD commit.

Feature On Off Cost Sig
densityAware: true vs false 33.71 us 31.75 us ~same 0.116
alignBy: visual-center-y vs bounds 1.03 us 50 ns 21× slower <0.001 ***
cropToContent: true vs false 2.14 ms 43 ns 2.14 ms <0.001 ***
layout update: full mount vs cached 831.27 us 1.90 us 437× slower <0.001 ***

Full benchmark output in the CI job logs.

@RostiMelk RostiMelk merged commit 0666d5d into main Feb 9, 2026
4 of 6 checks passed
@RostiMelk RostiMelk mentioned this pull request Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant