theme/devtools/checkbox.go
Functions
func PaintCheckbox
func (p CheckboxPainter) PaintCheckbox(canvas widget.Canvas, state checkbox.PaintState) {
if state.Bounds.IsEmpty() {
return
}
colors := state.ColorScheme
if colors == (checkbox.CheckboxColorScheme{}) {
colors = p.resolveColors()
}
boxRect := dtCheckboxBoxRect(state.Bounds)
disabled := state.Disabled
if state.Checked || state.Indeterminate {
dtPaintCheckedBox(canvas, boxRect, state, disabled, colors)
} else {
dtPaintUncheckedBox(canvas, boxRect, state, disabled, colors)
}
// Label.
if state.Label != "" {
fg := colors.LabelColor
if disabled {
fg = colors.DisabledFg
}
labelBounds := dtCheckboxLabelBounds(state.Bounds)
canvas.DrawText(state.Label, labelBounds, dtCBFontSize, fg, false, dtCBTextAlignLeft)
}
// Focus indicator.
if state.Focused && !disabled {
dtDrawFocusRing(canvas, boxRect, dtCBCornerRadius, colors.FocusRing)
}
}
Structs
type CheckboxPainter struct
CheckboxPainter renders checkboxes using DevTools design tokens.
DevTools checkboxes are 16px with 2px corner radius, matching JetBrains
IDE settings panel checkbox styling.
If Theme is nil, CheckboxPainter falls back to the default DevTools dark palette.
type CheckboxPainter struct {
Theme *Theme // nil uses default DevTools dark fallback
}
PaintCheckbox renders a checkbox according to DevTools design specifications.