Skip to content
ChromaBrew
Go Pro
TutorialsBy Opeyemi Olorunfemi

Transparency in UI: scrims, glass, and overlays

A worked tutorial: use rgba and HEX8 for scrims, glass cards, and modal dims — with contrast checks for the blended result.

The scrim: transparency's highest calling

A scrim is a transparent-to-opaque black gradient over imagery that gives text a predictable background. Build it from two stops of black (0% to ~70%) rather than a flat overlay — the gradient preserves the image's drama at the top while the text zone at the bottom is effectively solid. Headlines on photos without scrims are the web's most common contrast failure.

Get the values as HEX8 or rgba in one pass and declare the scrim as its own layer, not baked into the image. Content changes; the scrim's protection should not depend on any particular photo.

Glass cards without the washout

Glassmorphism (translucent fill plus backdrop blur) fails when the fill is too transparent: text floats over whatever is behind, contrast unmeasurable. The fix is a fill opaque enough to anchor text (start around 70% of the surface color) with the blur providing the glass feel, not the transparency. Blur is atmosphere; opacity is structure.

Check the card's text against the busiest background it can sit on, not the calmest. Glass over a flat gray passes; the same glass over photography fails — and cards move.

Measure the blend, not the swatch

A contrast ratio belongs to the final pixel: 50% black over white is gray, and it is the gray that must pass. Sample rendered colors (eyedropper the composited result) for scrims and overlays rather than trusting the base swatch — transparency math in your head is always optimistic.

Modal dims get the same treatment: the dim must darken the page enough that the dialog reads as a separate layer, typically black at 40–60%. Below that the page competes; above it the context vanishes.

Tip

Test overlays over the loudest page in the product, not the cleanest. Transparency that survives the dashboard survives everything.

Related free tools

Want to apply this right now? Open the color palette generator and try it with your own brand color — free, no sign-up.