theme/devtools/tabview.go
Functions
func PaintTabBar
func (p TabViewPainter) PaintTabBar(canvas widget.Canvas, ps tabview.PaintState) {
if ps.Bounds.IsEmpty() {
return
}
colors := ps.ColorScheme
if colors == (tabview.TabColorScheme{}) {
colors = p.resolveColors()
}
// Tab bar background.
canvas.DrawRect(ps.Bounds, colors.Background)
// Draw each tab.
for i := range ps.Tabs {
ts := &ps.Tabs[i]
dtPaintTab(canvas, ts, colors)
}
// Selected indicator: 2px underline (DevTools style, no pill).
if ps.SelectedIdx >= 0 && ps.SelectedIdx < len(ps.Tabs) {
selected := &ps.Tabs[ps.SelectedIdx]
dtPaintTabIndicator(canvas, selected.Bounds, ps.Position, colors.Indicator)
}
// Focus ring.
if ps.Focused {
canvas.StrokeRect(ps.Bounds, colors.FocusRing, dtTabFocusRingStroke)
}
}
Structs
type TabViewPainter struct
TabViewPainter renders tab bars using DevTools design tokens.
DevTools tabs use a flat underline indicator (2px Blue6) instead of pills,
matching JetBrains IDE editor tab styling. Unselected tabs show Gray9 text,
selected tabs show Gray12 text with a bold bottom accent line.
If Theme is nil, TabViewPainter falls back to the default DevTools dark palette.
type TabViewPainter struct {
Theme *Theme // nil uses default DevTools dark fallback
}
PaintTabBar renders a tab bar according to DevTools design specifications.