Keeping component colors flexible with transparency
Paul Hebert's post on the Cloudfour blog, flagged by CSS-Tricks, looks at how to colorize a component so it holds up when its surroundings change.
The starting point is a familiar design comp: a card whose header background is #dddddd and whose content background is #ffffff, sitting on an overall background of #eeeeee. That combination is simple to build. The trouble appears when the overall background itself becomes #dddddd — the header then gets lost inside it.
Hebert's point is that the exact #dddddd value isn't what matters in design terms. What matters is the header looking slightly darker than whatever sits behind it. When that's the goal, a background such as rgba(0, 0, 0, 0.135) is more resilient, and it stays resilient against backgrounds of any kind.
- Header:
#dddddd - Content:
#ffffff - Overall background:
#eeeeee - Suggested transparent header:
rgba(0, 0, 0, 0.135)
Ads are self-hosted



