theme/devtools/stripe.go

Functions Structs

Functions

func PaintBackground

PaintBackground renders the stripe background with a 1px border.

func (p StripePainter) PaintBackground(canvas widget.Canvas, bounds geometry.Rect) {
	if bounds.IsEmpty() {
		return
	}
	colors := p.resolveColors()
	canvas.DrawRect(bounds, colors.Background)

	// 1px right border for left stripe, left border for right stripe.
	borderRect := geometry.NewRect(
		bounds.Max.X-dtStripeBorderWidth,
		bounds.Min.Y,
		dtStripeBorderWidth,
		bounds.Height(),
	)
	canvas.DrawRect(borderRect, colors.Border)
}

func PaintButton

PaintButton renders a stripe button with icon and optional label.

func (p StripePainter) PaintButton(canvas widget.Canvas, state stripe.ButtonPaintState) {
	if state.Bounds.IsEmpty() {
		return
	}
	colors := p.resolveColors()

	// Background on hover/press/active.
	bg := widget.ColorTransparent
	switch {
	case state.Pressed:
		bg = colors.PressedBg
	case state.Hovered:
		bg = colors.HoverBg
	case state.Active:
		bg = colors.ActiveBg
	}
	if !bg.IsTransparent() {
		canvas.DrawRoundRect(state.Bounds, bg, dtStripeButtonRadius)
	}

	// Icon color.
	fg := colors.Foreground
	if state.Active {
		fg = colors.ActiveFg
	}

	// Draw icon centered horizontally.
	iconBounds := dtStripeIconBounds(state.Bounds, state.ShowLabel)
	icon.Draw(canvas, state.Icon, iconBounds, fg)

	// Draw label below icon if enabled.
	if state.ShowLabel && state.Label != "" {
		textBounds := dtStripeTextBounds(state.Bounds, iconBounds)
		canvas.DrawText(state.Label, textBounds, dtStripeLabelFontSize, fg, false, widget.TextAlignCenter)
	}
}

Structs

type StripePainter struct

StripePainter renders stripe toolbars using DevTools design tokens.

DevTools stripes use a Surface background with a 1px border, and

SquareStripeButton styling: 40x40 buttons, 20px icons, 12px corner

radius on hover, matching JetBrains IDE tool window strip styling.

 

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

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