Blog

How iPhone Safari picks the color of its toolbar, and how to control it

Since iOS 26, Safari on iPhone floats its address bar over your page. The strip behind the clock at the top and the area around the toolbar at the bottom take their color from your page. Sometimes your content shows through them, softly blurred. Sometimes they turn into a flat band of a color you never chose.

Apple hasn't documented how this works. Everything below comes from WebKit bug reports, developers' write-ups and test pages, and our own tests in Safari on the iOS Simulator. Where the sources disagree, I say so.

theme-color doesn't do it any more

Up to iOS 18, <meta name="theme-color" content="…"> tinted Safari's bars. In iOS 26 Safari, a normal tab ignores it. Some sources say it still works for web apps added to the Home Screen; others report it doesn't work there either.

If you set theme-color and your bars came out white, this is why.

Where the color comes from

Safari checks, in this order:

  1. A fixed element touching the top or bottom edge. Its background-color wins.
  2. The body background color.
  3. The html background color.
  4. Nothing set: white in light mode, black in dark mode.

Safari also picks light or dark text and icons for its bars from how bright that color is.

What counts as "a fixed element at the edge"

Roughly: position: fixed, close to the edge, nearly full width, a few pixels tall, with a solid background. The exact numbers vary by source:

  • Distance from the edge: within about 4px of the top or 3px of the bottom. An element can hang partly off screen, for example bottom: -8px with min-height: 12px.
  • Width: at least 80% of the screen on iPhone, 90% on a Mac. One write-up found it needed the full width.
  • Height: reports range from 3px to 6px. 12px is safe.
  • Sticky: sources disagree on whether position: sticky counts. Use fixed.
  • A border-bottom on the element can supply the color instead of its background.

These don't count:

  • elements with display: none
  • elements with backdrop-filter or a translucent background, even opacity: 0.9
  • children and ::before/::after of a fixed element; only the element itself counts

When content shows through the bars

Content only shows through, blurred, when two things are true.

The whole page scrolls. Many web apps put everything in one full-screen box and scroll a panel inside it. Safari sees a page that never moves and keeps its bars solid. Let the document itself scroll.

Nothing is pinned near that edge. In our tests, every one of these turned the top bar solid:

  • a full-width fixed header
  • the same header as position: sticky
  • a fixed button no wider than itself
  • a fixed button 300px down from the top

Only leaving nothing pinned at the top made it see-through. The bottom works the same way: a pinned tab bar or footer makes Safari's bottom area solid.

Shadows count. A pinned button's drop shadow bled about 12px up into the status bar and turned it solid. A shadow that only falls downward, like box-shadow: 0 8px 12px -4px rgb(0 0 0 / .2), avoided it.

So each edge gets one of two things: a header or footer that stays on screen, or a see-through bar. You can't have both at the same edge.

Hacks that work

Set the page background

The simplest fix for wrong-colored bars:

html, body { background: #1400ff; }

Your sections paint over it, so the color only shows in Safari's bars and when you pull past the top or bottom of the page.

Add an edge strip

To give one bar a different color from the page, add a thin fixed strip on that edge, in the color you want:

.safari-tint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -8px;
  min-height: 12px;
  background: #e8e3fc;
  z-index: 5;
  display: none;
}
@supports (-webkit-touch-callout: none) {
  @media (width < 768px) { .safari-tint { display: block; } }
}

The @supports line limits it to iOS. The width check keeps it off iPads, where it showed up as a visible line. Controlling the bottom bar also needs viewport-fit=cover in your viewport meta tag.

Make your fixed footer the exact color

A fixed tab bar or footer decides the bottom color anyway. Give it a solid background in exactly that color, sit it flush on the bottom edge, and pad it with padding-bottom: env(safe-area-inset-bottom). It then reads as one surface with Safari's toolbar.

Slide a top strip away on scroll

Hiding a strip makes Safari ignore it, so you can't keep a color source and make it invisible. One workaround uses a scroll-driven animation (animation-timeline: scroll()) to move the strip up off screen once the visitor scrolls past about 10px, and Safari keeps the color it already picked. Caveats: reloading partway down the page loses the color, and older browsers without scroll-driven animations need the strip hidden.

Traps

  • The color can stick. Safari re-checks while you scroll, not while the page stands still. What's on screen when scrolling stops is what you keep, and if Safari stops honoring a strip, the bar can stay on the last color.
  • Single-page apps (Safari 26.2): after a swipe back or in-app navigation, Safari can drop a fixed header's color. WebKit bug 305546 is open.
  • Dialogs and overlays used to take over the bar color (WebKit bug 302272). WebKit says it's fixed in newer builds; retest yours.
  • backdrop-filter near the bottom edge can come out as opaque white.
  • Transforms trap fixed elements. A transform or will-change: transform on a parent stops position: fixed working the way you expect.
  • Visitors can turn it off. Settings › Apps › Safari › Tabs › Allow Website Tinting on iPhone, and "Show color in tab bar" on a Mac.

Testing it

Desktop Chrome's phone view doesn't draw Safari's bars, so it can't show any of this. Use Safari on the iOS Simulator or a real iPhone. Fully close Safari between tries, and judge from full-size screenshots: a small one can make a solid bar look see-through.

Further reading