theme/material3/scrollbar.go

Functions Structs

Functions

func PaintScrollbar

PaintScrollbar renders scrollbars according to Material 3 specifications.

func (p ScrollbarPainter) PaintScrollbar(canvas widget.Canvas, ps scrollview.PaintState) {
	if ps.Bounds.IsEmpty() {
		return
	}

	colors := ps.ColorScheme
	if colors == (scrollview.ScrollbarColorScheme{}) {
		colors = p.resolveColors()
	}

	// Override paint state with resolved colors.
	ps.ColorScheme = colors

	// Delegate to default painter with resolved colors.
	scrollview.DefaultPainter{}.PaintScrollbar(canvas, ps)
}

Structs

type ScrollbarPainter struct

ScrollbarPainter renders scrollbars using Material 3 design tokens.

It maps scrollbar states (normal, hover, dragging) to the M3 color scheme.

 

If Theme is nil, ScrollbarPainter falls back to the default M3 scrollbar palette.

type ScrollbarPainter struct {
	Theme *Theme	// nil uses default M3 fallback
}