theme/devtools/listview.go

Functions Structs

Functions

func PaintDivider

PaintDivider draws a DevTools-styled divider between list items.

func (p ListViewPainter) PaintDivider(canvas widget.Canvas, ds listview.DividerState) {
	if ds.Bounds.IsEmpty() {
		return
	}
	colors := ds.ColorScheme
	if colors == (listview.ListColorScheme{}) {
		colors = p.resolveColors()
	}
	canvas.DrawRect(ds.Bounds, colors.DividerColor)
}

func PaintEmptyState

PaintEmptyState draws a centered "No items" message.

func (p ListViewPainter) PaintEmptyState(canvas widget.Canvas, bounds geometry.Rect) {
	if bounds.IsEmpty() {
		return
	}
	colors := p.resolveColors()
	canvas.DrawText(
		dtListEmptyStateText,
		bounds,
		dtListEmptyStateFontSize,
		colors.EmptyTextColor,
		false,
		dtListEmptyStateAlign,
	)
}

func PaintItemBackground

PaintItemBackground draws the DevTools item background with hover state.

func (p ListViewPainter) PaintItemBackground(canvas widget.Canvas, ips listview.ItemPaintState) {
	if ips.Bounds.IsEmpty() {
		return
	}
	colors := ips.ColorScheme
	if colors == (listview.ListColorScheme{}) {
		colors = p.resolveColors()
	}

	// Hover highlight.
	if ips.Hovered && !ips.Disabled {
		canvas.DrawRect(ips.Bounds, colors.HoverColor)
	}
}

func PaintSelection

PaintSelection draws the DevTools selection highlight (full-row, no rounded corners).

func (p ListViewPainter) PaintSelection(canvas widget.Canvas, ips listview.ItemPaintState) {
	if ips.Bounds.IsEmpty() || !ips.Selected {
		return
	}
	colors := ips.ColorScheme
	if colors == (listview.ListColorScheme{}) {
		colors = p.resolveColors()
	}
	canvas.DrawRect(ips.Bounds, colors.SelectionColor)

	// Focus border (1px DevTools style).
	if ips.Focused && !ips.Disabled {
		canvas.StrokeRect(ips.Bounds, colors.FocusColor, dtListFocusBorderWidth)
	}
}

Structs

type ListViewPainter struct

ListViewPainter renders list view elements using DevTools design tokens.

DevTools lists use wide full-row selection (Blue2 background), 24px row

height, ControlHover highlight, and optional alternating rows

(Background/Surface), matching JetBrains IDE file list styling.

 

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

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