rotheme

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package rotheme centralizes the Ragnarok-style gogpu/ui theme values.

Index

Constants

View Source
const (
	ButtonRadius        float32 = 6
	ButtonPaddingX      float32 = 8
	ButtonPaddingY      float32 = 5.5
	LargeButtonPaddingY float32 = 8.5
)
View Source
const (
	CheckboxSize   float32 = 17
	CheckboxRadius float32 = 6
	CheckboxGap    float32 = 8
)
View Source
const (
	RadioSize float32 = 13
	RadioGap  float32 = 7
)
View Source
const (
	SliderTrackHeight float32 = 6
	SliderThumbSize   float32 = 16
)
View Source
const (
	TableRowHeight = float32(14)
	TableGap       = float32(1)
	TableCellPadX  = float32(4)
)
View Source
const (
	ContextMenuItemHeight = 18
)
View Source
const IconButtonSize float32 = 17
View Source
const SelectListRowPadX float32 = 6
View Source
const TableHeaderPadY = float32(4)

Variables

View Source
var Default = Theme{
	Colors: Colors{
		WindowBody:     fromRGBA(color.RGBA{R: 255, G: 255, B: 255, A: 255}),
		WindowTitleTop: fromRGBA(color.RGBA{R: 214, G: 232, B: 250, A: 255}),
		WindowTitle:    fromRGBA(color.RGBA{R: 184, G: 214, B: 242, A: 255}),
		WindowBorder:   fromRGBA(color.RGBA{R: 118, G: 160, B: 206, A: 255}),
		WindowFooter:   fromRGBA(color.RGBA{R: 244, G: 246, B: 248, A: 255}),
		FooterLine:     fromRGBA(color.RGBA{R: 174, G: 180, B: 188, A: 255}),
		PanelBody:      fromRGBA(color.RGBA{R: 250, G: 252, B: 255, A: 255}),
		Button:         fromRGBA(color.RGBA{R: 236, G: 244, B: 252, A: 255}),
		ButtonHover:    fromRGBA(color.RGBA{R: 218, G: 235, B: 250, A: 255}),
		ButtonDown:     fromRGBA(color.RGBA{R: 198, G: 222, B: 245, A: 255}),
		ButtonBorder:   fromRGBA(color.RGBA{R: 138, G: 174, B: 214, A: 255}),
		Disabled:       fromRGBA(color.RGBA{R: 226, G: 230, B: 235, A: 255}),
		Text:           fromRGBA(color.RGBA{R: 38, G: 48, B: 58, A: 255}),
		TitleText:      fromRGBA(color.RGBA{R: 22, G: 54, B: 88, A: 255}),
		LabelText:      fromRGBA(color.RGBA{R: 58, G: 104, B: 156, A: 255}),
		MutedText:      fromRGBA(color.RGBA{R: 98, G: 112, B: 126, A: 255}),
		InputBorder:    fromRGBA(color.RGBA{R: 138, G: 174, B: 214, A: 255}),
		InputFocus:     fromRGBA(color.RGBA{R: 82, G: 138, B: 200, A: 255}),
	},
	Typography: Typography{
		FontFamily: uiFontFamily,
		TextSize:   11,
	},
}

Functions

func Button

func Button(label string, onClick func()) *primitives.BoxWidget

func ButtonDisabled

func ButtonDisabled(label string, disabled bool, onClick func()) *primitives.BoxWidget

func ButtonDisabledFn

func ButtonDisabledFn(label string, disabled func() bool, onClick func()) *primitives.BoxWidget

func Checkbox

func Checkbox(opts ...checkbox.Option) *checkbox.Widget

func ContextMenuItem added in v0.6.0

func ContextMenuItem(label string, onClick func()) *primitives.BoxWidget

ContextMenuItem keeps the standard button interaction behavior while using the flat, compact appearance of an action in a context menu.

func DrawIconButton

func DrawIconButton(canvas widget.Canvas, bounds geometry.Rect, kind IconButtonKind, hovered, disabled bool)

func DrawLabel added in v0.11.0

func DrawLabel(canvas widget.Canvas, content string, bounds geometry.Rect, align widget.TextAlign)

DrawLabel renders the semantic label style on a canvas.

func DrawRotatedText added in v0.6.0

func DrawRotatedText(canvas widget.Canvas, text string, bounds geometry.Rect, size float32, textColor widget.Color, bold bool, rotation TextRotation)

DrawRotatedText draws centered text at a right-angle rotation. Horizontal text continues through DrawText so it retains the canvas's native shaping.

func DrawText

func DrawText(canvas widget.Canvas, text string, bounds geometry.Rect, size float32, color widget.Color, bold bool, align widget.TextAlign)

func DrawVerticalGradient added in v0.6.0

func DrawVerticalGradient(canvas widget.Canvas, bounds geometry.Rect, top, bottom widget.Color)

DrawVerticalGradient draws a continuous top-to-bottom gradient as one image. The image rasterizes itself at the display's physical scale, avoiding seams between logical rows at fractional scaling factors.

func DrawVerticalGradientWithBottomBorder added in v0.6.0

func DrawVerticalGradientWithBottomBorder(canvas widget.Canvas, bounds geometry.Rect, top, bottom, border widget.Color, borderHeight float32)

DrawVerticalGradientWithBottomBorder draws the gradient and its bottom border in one image so fractional scaling cannot introduce a seam between them.

func IconButton

func IconButton(kind IconButtonKind, onClick func()) *primitives.BoxWidget

func IconButtonDisabled

func IconButtonDisabled(kind IconButtonKind, disabled bool, onClick func()) *primitives.BoxWidget

func Label added in v0.11.0

func Label(content string) *primitives.TextWidget

func LargeButton

func LargeButton(label string, onClick func()) *primitives.BoxWidget

func LargeButtonDisabled

func LargeButtonDisabled(label string, disabled bool, onClick func()) *primitives.BoxWidget

func MeasureText

func MeasureText(canvas widget.Canvas, text string, size float32, bold bool) float32

func Radio

func Radio(opts ...radio.GroupOption) *radio.Group

func SelectListRow

func SelectListRow(label string, enabled bool, height float32) widget.Widget

func Slider

func Slider(opts ...slider.Option) *slider.Widget

func Table

func Table(rows []TableRow, opts ...TableOption) widget.Widget

func Text

func Text(content string) *primitives.TextWidget

func TextField

func TextField(value string, inputType textfield.InputType, onChange func(string), onSubmit func(string), extra ...textfield.Option) *textfield.Widget

func Title

func Title(content string) *primitives.TextWidget

Types

type ButtonPainter

type ButtonPainter struct{}

func (ButtonPainter) PaintButton

func (ButtonPainter) PaintButton(canvas widget.Canvas, state button.PaintState)

type CheckboxPainter

type CheckboxPainter struct{}

func (CheckboxPainter) PaintCheckbox

func (CheckboxPainter) PaintCheckbox(canvas widget.Canvas, state checkbox.PaintState)

type Colors

type Colors struct {
	WindowBody     widget.Color
	WindowTitleTop widget.Color
	WindowTitle    widget.Color
	WindowBorder   widget.Color
	WindowFooter   widget.Color
	FooterLine     widget.Color
	PanelBody      widget.Color
	Button         widget.Color
	ButtonHover    widget.Color
	ButtonDown     widget.Color
	ButtonBorder   widget.Color
	Disabled       widget.Color
	Text           widget.Color
	TitleText      widget.Color
	LabelText      widget.Color
	MutedText      widget.Color
	InputBorder    widget.Color
	InputFocus     widget.Color
}

type ContextMenuItemPainter added in v0.6.0

type ContextMenuItemPainter struct{}

func (ContextMenuItemPainter) PaintButton added in v0.6.0

func (ContextMenuItemPainter) PaintButton(canvas widget.Canvas, state button.PaintState)
type DropdownPainter struct{}
func (DropdownPainter) PaintMenu(canvas widget.Canvas, state *dropdown.MenuPaintState)
func (DropdownPainter) PaintTrigger(canvas widget.Canvas, state *dropdown.TriggerPaintState)

type IconButtonKind

type IconButtonKind int
const (
	IconButtonClose IconButtonKind = iota
	IconButtonPlus
	IconButtonMinus
	IconButtonLeft
	IconButtonRight
	IconButtonUp
	IconButtonDown
)

type IconButtonPainter

type IconButtonPainter struct {
	Kind IconButtonKind
}

func (IconButtonPainter) PaintButton

func (p IconButtonPainter) PaintButton(canvas widget.Canvas, state button.PaintState)

type RadioPainter

type RadioPainter struct{}

func (RadioPainter) PaintRadio

func (RadioPainter) PaintRadio(canvas widget.Canvas, state radio.PaintState)

type SelectListPainter

type SelectListPainter struct {
	EmptyText string
}

func (SelectListPainter) PaintDivider

func (SelectListPainter) PaintEmptyState

func (p SelectListPainter) PaintEmptyState(canvas widget.Canvas, bounds geometry.Rect)

func (SelectListPainter) PaintItemBackground

func (SelectListPainter) PaintItemBackground(canvas widget.Canvas, state listview.ItemPaintState)

func (SelectListPainter) PaintSelection

func (SelectListPainter) PaintSelection(canvas widget.Canvas, state listview.ItemPaintState)

type SliderPainter

type SliderPainter struct{}

func (SliderPainter) PaintSlider

func (SliderPainter) PaintSlider(canvas widget.Canvas, state slider.PaintState)

type TableCell

type TableCell struct {
	Text  string
	Width float32
	Align widget.TextAlign
	Head  bool
}

type TableOption

type TableOption func(*tableWidget)

func TableColors

func TableColors(headBG, cellBG widget.Color) TableOption

func TableRowHeightOpt

func TableRowHeightOpt(height float32) TableOption

type TableRow

type TableRow []TableCell

type TableViewCellContext

type TableViewCellContext struct {
	Row         int
	ColumnIndex int
	Column      TableViewColumn
	Width       float32
	Height      float32
}

type TableViewColumn

type TableViewColumn struct {
	Key      string
	Title    string
	Width    float32
	Flex     float32
	MinWidth float32
	Align    widget.TextAlign
}

type TableViewOption

type TableViewOption func(*tableViewConfig)

func TableViewBuildCell

func TableViewBuildCell(build func(TableViewCellContext) widget.Widget) TableViewOption

func TableViewBuildSimpleCell

func TableViewBuildSimpleCell(build func(TableViewCellContext) TableViewSimpleCell) TableViewOption

func TableViewColumns

func TableViewColumns(columns []TableViewColumn) TableViewOption

func TableViewDispatchHoverToCells

func TableViewDispatchHoverToCells(dispatch bool) TableViewOption

func TableViewEmptyText

func TableViewEmptyText(text string) TableViewOption

func TableViewHeaderHeight

func TableViewHeaderHeight(height float32) TableViewOption

func TableViewInvalidateHover

func TableViewInvalidateHover(invalidate bool) TableViewOption

func TableViewOnRowClick

func TableViewOnRowClick(onClick func(int)) TableViewOption

func TableViewOnRowEvent

func TableViewOnRowEvent(onEvent func(int, event.Event) bool) TableViewOption

func TableViewOnRowEventWithContext

func TableViewOnRowEventWithContext(onEvent func(widget.Context, int, event.Event) bool) TableViewOption

func TableViewRowCount

func TableViewRowCount(count int) TableViewOption

func TableViewRowHeight

func TableViewRowHeight(height float32) TableViewOption

func TableViewScrollYSignal

func TableViewScrollYSignal(scrollY state.Signal[float32]) TableViewOption

func TableViewSelectedRow

func TableViewSelectedRow(selectedRow state.Signal[int]) TableViewOption

func TableViewShowHeader

func TableViewShowHeader(show bool) TableViewOption

type TableViewSimpleCell

type TableViewSimpleCell struct {
	Text               string
	Icon               image.Image
	Align              widget.TextAlign
	Color              widget.Color
	Hidden             bool
	IconButton         IconButtonKind
	HasIconButton      bool
	IconButtonDisabled bool
}

func TableViewIconButtonCell

func TableViewIconButtonCell(kind IconButtonKind, disabled bool) TableViewSimpleCell

type TableViewWidget

type TableViewWidget struct {
	widget.WidgetBase
	// contains filtered or unexported fields
}

func TableView

func TableView(opts ...TableViewOption) *TableViewWidget

func (*TableViewWidget) Children

func (w *TableViewWidget) Children() []widget.Widget

func (*TableViewWidget) Draw

func (w *TableViewWidget) Draw(ctx widget.Context, canvas widget.Canvas)

func (*TableViewWidget) Event

func (w *TableViewWidget) Event(ctx widget.Context, e event.Event) bool

func (*TableViewWidget) InvalidateRow added in v0.6.0

func (w *TableViewWidget) InvalidateRow(ctx widget.Context, row int)

InvalidateRow redraws one materialized row without rebuilding the table.

func (*TableViewWidget) IsFocusable

func (w *TableViewWidget) IsFocusable() bool

func (*TableViewWidget) Layout

func (w *TableViewWidget) Layout(ctx widget.Context, constraints geometry.Constraints) geometry.Size

func (*TableViewWidget) Mount

func (w *TableViewWidget) Mount(ctx widget.Context)

func (*TableViewWidget) Unmount

func (w *TableViewWidget) Unmount()

type TextAreaWidget added in v0.11.0

type TextAreaWidget struct {
	widget.WidgetBase
	// contains filtered or unexported fields
}

TextAreaWidget is a small, wrapped multiline editor. It uses the same font, focus, clipboard and pointer capture services as the other UI inputs. Positions are rune offsets; maxBytes bounds the encoded text, not its glyphs.

func TextArea added in v0.11.0

func TextArea(value string, maxBytes int, onChange func(string)) *TextAreaWidget

func (*TextAreaWidget) Draw added in v0.11.0

func (w *TextAreaWidget) Draw(_ widget.Context, canvas widget.Canvas)

func (*TextAreaWidget) Event added in v0.11.0

func (w *TextAreaWidget) Event(ctx widget.Context, e event.Event) bool

func (*TextAreaWidget) IsFocusable added in v0.11.0

func (w *TextAreaWidget) IsFocusable() bool

func (*TextAreaWidget) Layout added in v0.11.0

func (w *TextAreaWidget) Layout(_ widget.Context, constraints geometry.Constraints) geometry.Size

func (*TextAreaWidget) SetReadOnly added in v0.11.0

func (w *TextAreaWidget) SetReadOnly(readOnly bool)

func (*TextAreaWidget) Text added in v0.11.0

func (w *TextAreaWidget) Text() string

type TextFieldPainter

type TextFieldPainter struct{}

func (TextFieldPainter) PaintTextField

func (TextFieldPainter) PaintTextField(canvas widget.Canvas, state *textfield.PaintState)

type TextRotation added in v0.6.0

type TextRotation uint8
const (
	TextRotationNone TextRotation = iota
	TextRotationCounterClockwise
	TextRotationClockwise
)

type Theme

type Theme struct {
	Colors     Colors
	Typography Typography
}

func (Theme) AsTheme

func (t Theme) AsTheme() *theme.Theme

func (Theme) IsDark

func (t Theme) IsDark() bool

func (Theme) OnSurface

func (t Theme) OnSurface() widget.Color

type Typography

type Typography struct {
	FontFamily string
	TextSize   float32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL