themes

package
v0.0.0-...-9a070ab Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Button

func Button(disabled *bool, w glui.Widget, onClick func(ctx *glui.Context, area geom.Rect)) glui.Widget

func ChangeColorAlpha

func ChangeColorAlpha(c glen.Color, a float32) glen.Color

func CheckDisabled

func CheckDisabled(disabled *bool, widget glui.Widget) glui.Widget

func Checkbox

func Checkbox(disabled, checked *bool, onChange func(checked bool)) glui.Widget

func Color

func Color(c string) glen.Color

func Input

func Input(disabled *bool,
	placeholder glui.Widget,
	text string,
	onStart func() (focused bool),
	onChange func(text []rune),
	onEnd func(text string, esc bool) (keepFocus bool),
) glui.Widget

func InputFunc

func InputFunc(
	disabled *bool,
	placeholder glui.Widget,
	content func() string,
	onStart func() (focused bool),
	onChange func(text []rune),
	onEnd func(text string, esc bool) (keepFocus bool),
) glui.Widget

func IsValidColor

func IsValidColor(c string) bool

func Label

func Label(text string) glui.Widget

func LabelWithStyle

func LabelWithStyle(text string, style FontStyle) glui.Widget

func OnDoubleClick

func OnDoubleClick(
	onSingleClick, onDoubleClick func(ctx *glui.Context, area geom.Rect),
) func(ctx *glui.Context, area geom.Rect)

func OnDoubleClickT

func OnDoubleClickT[T any](
	onSingleClick, onDoubleClick func(item T, ctx *glui.Context, area geom.Rect),
) func(item T, ctx *glui.Context, area geom.Rect)

func Slider

func Slider(disabled *bool, axis glui.Axis, ratio *float32, onChange func(ctx *glui.Context)) glui.Widget

func Strings

func Strings(s ...string) glui.WidgetList

func Text

func Text(text string) glui.Widget

func TextFunc

func TextFunc(text func() string) glui.Widget

func TextFuncWithStyle

func TextFuncWithStyle(text func() string, style FontStyle) glui.Widget

func TextWithStyle

func TextWithStyle(text string, style FontStyle) glui.Widget

func Tooltip

func Tooltip(disabled *bool, widget, tip glui.Widget) glui.Widget

func TreeFS

func TreeFS(
	fsys fs.FS,
	ready *atomic.Bool,
	widget func(item string, depth int, open bool) glui.Widget,
	filter func(path string) (keep bool),
	onBusy glui.Widget,
	onClick glui.ClickTCallback[string],
) glui.Widget

Types

type BackgroundStyle

type BackgroundStyle struct {
	Fill    glui.Rect
	Outline glui.Rect
}

func (BackgroundStyle) Widget

func (bg BackgroundStyle) Widget() glui.Widget

type ButtonStyle

type ButtonStyle struct {
	Padding    float32
	Background BackgroundStyle
	Hover      glui.Rect
}

type CheckboxStyle

type CheckboxStyle struct {
	Padding    float32
	Foreground glen.Color
	Check      glui.Widget
	Uncheck    glui.Widget
}
type Dropdown struct {
	Alignment    glui.Alignment
	MaxNumItems  int
	SelectedItem int
}
func (dd Dropdown) Widget(disabled *bool, onChange func(index int), list glui.WidgetList) glui.Widget
func (dd Dropdown) Widgets(disabled *bool, onChange func(index int), widgets ...glui.Widget) glui.Widget
type DropdownStyle struct {
	PopupClosed     glui.Widget
	PopupOpen       glui.Widget
	PopupBackground BackgroundStyle
}

type FontStyle

type FontStyle struct {
	Color     glen.Color
	Size      float32
	Alignment glui.Alignment

	Font glen.TextureFont
}

func (*FontStyle) MeasureText

func (fs *FontStyle) MeasureText(text string) geom.Vec2

type InputStyle

type InputStyle struct {
	Padding     float32
	Background  BackgroundStyle
	Outline     glen.Color
	Cursor      glui.Widget
	CursorBlink time.Duration
}

type List

type List struct {
	Axis      glui.Axis
	Alignment glui.Alignment
}

func (List) Widget

func (l List) Widget(firstIndex *atomic.Int32, onClick func(index int, ctx *glui.Context, area geom.Rect), list glui.WidgetList) glui.Widget

func (List) Widgets

func (l List) Widgets(firstIndex *atomic.Int32, onClick func(index int, ctx *glui.Context, area geom.Rect), widgets ...glui.Widget) glui.Widget

type ListStyle

type ListStyle struct {
	Padding float32
}

type Palette

type Palette struct {
	BG        glen.Color
	FG        glen.Color
	Selection glen.Color
	Comment   glen.Color
	BGLight   glen.Color
	BGLighter glen.Color
	BGDark    glen.Color
	BGDarker  glen.Color
	Cyan      glen.Color
	Green     glen.Color
	Orange    glen.Color
	Pink      glen.Color
	Purple    glen.Color
	Red       glen.Color
	Yellow    glen.Color
	Disabled  func(glen.Color) glen.Color
}

type ProgressBar

type ProgressBar struct {
	Axis glui.Axis
}

TODO ProgressBar

func (ProgressBar) Widget

func (pb ProgressBar) Widget(disabled *bool, onChange <-chan float32) glui.Widget

type SliderStyle

type SliderStyle struct {
	Padding    float32
	Background BackgroundStyle
	Handle     glui.Widget
}

type Split

type Split struct {
	Axis        glui.Axis
	MouseButton glen.MouseButton
}

func (Split) Widget

func (sp Split) Widget(disabled *bool, ratio *float32, w1, w2 glui.Widget) glui.Widget

type SplitStyle

type SplitStyle struct {
	Padding    float32
	Background BackgroundStyle
	Resizing   BackgroundStyle
	Hover      BackgroundStyle
	HandleHor  glui.Widget
	HandleVer  glui.Widget
}

type Tabs

type Tabs struct {
	Axis      glui.Axis
	Alignment glui.Alignment
}

func (Tabs) Widget

func (t Tabs) Widget(tabs, content glui.WidgetList) glui.Widget

type TabsStyle

type TabsStyle struct {
	Padding                float32
	SeparatorColor         glen.Color
	SeparatorWidth         float32
	UnselectedFGColorAlpha float32
}

type Theme

type Theme struct {
	Palette  Palette
	Busy     glui.Widget
	Body1    FontStyle
	H1       FontStyle
	H2       FontStyle
	H3       FontStyle
	H4       FontStyle
	H5       FontStyle
	Small    FontStyle
	Strong   FontStyle
	Button   ButtonStyle
	Checkbox CheckboxStyle
	Dropdown DropdownStyle
	Input    InputStyle
	List     ListStyle
	Slider   SliderStyle
	Split    SplitStyle
	Tabs     TabsStyle
	Tooltip  TooltipStyle
	Tree     TreeStyle
	Wrap     WrapStyle
}
var Default *Theme

func Dracula

func Dracula(window *glen.Window) *Theme

func (*Theme) MustSetFont

func (th *Theme) MustSetFont(window *glen.Window, ttf []byte)

func (*Theme) SetFont

func (th *Theme) SetFont(window *glen.Window, ttf []byte) error

type TooltipStyle

type TooltipStyle struct {
	Padding    float32
	Background BackgroundStyle
	Delay      time.Duration
	Label      FontStyle
}

type Tree

type Tree[T comparable] struct {
	Axis      glui.Axis
	Alignment glui.Alignment
}

func (Tree[T]) Widget

func (tr Tree[T]) Widget(
	tree glui.TreeWidget[T],
	onBusy glui.Widget,
	onClick glui.ClickTCallback[T],
) glui.Widget

type TreeStyle

type TreeStyle struct {
	Padding      float32
	Axis         glui.Axis
	Alignment    glui.Alignment
	MouseButton  glen.MouseButton
	Indentation  float32
	FolderOpen   glui.Widget
	FolderClosed glui.Widget
	File         glui.Widget
}

type Wrap

type Wrap struct {
	Axis      glui.Axis
	Alignment glui.Alignment
	MainSize  func(area geom.Rect) float32 // cross-axis size
}

func (Wrap) Widget

func (wr Wrap) Widget(list glui.WidgetList) glui.Widget

func (Wrap) Widgets

func (wr Wrap) Widgets(widgets ...glui.Widget) glui.Widget

type WrapStyle

type WrapStyle struct {
	Padding float32
}

Directories

Path Synopsis
icons

Jump to

Keyboard shortcuts

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