An evening well spent
“You can’t style those tabs.” So I did.
I’ve been building a Markdown app for almost a year. It uses SwiftUI’s DocumentGroup, so you get document tabs for free - which is great, except they’re flat gray system things you can’t touch. I wanted them to match the rest of the app. Dark, a little accent color, nothing wild.
I looked it up. The consensus online is basically “you can’t, the tab bar is private, give up.” So naturally I spent an evening proving that wrong.
DocumentGroup and build your own tab bar. But the moment you leave it you also give up Save, autosave, the Versions browser, window restoration, and the ⌘1-9 shortcuts. That’s a pile of plumbing to rebuild for slightly nicer chrome. Hard pass.Third option: keep all the native machinery and just repaint the chrome. The tab bar is a real view hierarchy - NSTabBar → NSTabButton - it’s just private. Walk down from the window’s content view, match the class names, grab the views, set layer.backgroundColor. First attempt was a garish test just to see if anything stuck.
It stuck. Once the layers proved paintable, the rest was just taste - themes, a recolored active tab, and eventually a color picker on right-click. I pulled the working part into a small MIT library. You hand it your colors plus an optional per-tab color closure, call start() once, and that’s it.