theme/material3/slider.go

Functions Structs

Functions

func PaintSlider

PaintSlider renders a slider according to Material 3 specifications.

func (p SliderPainter) PaintSlider(canvas widget.Canvas, ps slider.PaintState) {
	if ps.Bounds.IsEmpty() {
		return
	}

	// Determine the color scheme to use.
	colors := ps.ColorScheme
	if colors == (slider.SliderColorScheme{}) {
		colors = p.resolveColors()
	}

	disabled := ps.Disabled

	if ps.Orientation == slider.Vertical {
		m3PaintVerticalSlider(canvas, ps, disabled, colors)
	} else {
		m3PaintHorizontalSlider(canvas, ps, disabled, colors)
	}
}

Structs

type SliderPainter struct

SliderPainter renders sliders using Material 3 design tokens.

It maps slider states (normal, hover, dragging, disabled) to

the M3 color scheme and applies appropriate interaction feedback.

 

If Theme is nil, SliderPainter falls back to the default M3 purple palette.

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