theme/devtools/radio.go

Functions Structs

Functions

func PaintRadio

PaintRadio renders a radio item according to DevTools design specifications.

func (p RadioPainter) PaintRadio(canvas widget.Canvas, state radio.PaintState) {
	if state.Bounds.IsEmpty() {
		return
	}

	colors := state.ColorScheme
	if colors == (radio.RadioColorScheme{}) {
		colors = p.resolveColors()
	}

	disabled := state.Disabled
	center, radius := dtRadioCircleGeometry(state.Bounds)

	if state.Selected {
		dtPaintSelectedRadio(canvas, center, radius, state, disabled, colors)
	} else {
		dtPaintUnselectedRadio(canvas, center, radius, state, disabled, colors)
	}

	// Label.
	if state.Label != "" {
		fg := colors.LabelColor
		if disabled {
			fg = colors.DisabledFg
		}
		labelBounds := dtRadioLabelBounds(state.Bounds)
		canvas.DrawText(state.Label, labelBounds, dtRadioFontSize, fg, false, dtRadioTextAlignLeft)
	}

	// Focus ring.
	if state.Focused && !disabled {
		canvas.StrokeCircle(center, radius+dtRadioFocusRingOffset, colors.FocusRing, dtRadioFocusRingStrokeWidth)
	}
}

Structs

type RadioPainter struct

RadioPainter renders radio items using DevTools design tokens.

DevTools radio buttons are 16px diameter circles with a 6px inner dot

when selected, matching JetBrains IDE settings panel radio styling.

 

If Theme is nil, RadioPainter falls back to the default DevTools dark palette.

type RadioPainter struct {
	Theme *Theme	// nil uses default DevTools dark fallback
}