theme

package module
v0.0.0-...-0eb751e Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 8 Imported by: 0

README

Ebiten UI Themes

For mostly personal use. I needed a way to abstract away the colors of widgets in ebitenui

But if you want to use it...

I offer no support of any kind.

You have been advised.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DarkStyleState = StyleState{
	Idle: Style{
		BackgroundColor: color.RGBA{0x0f, 0x0f, 0x0f, 0xff},
		ForegroundColor: color.RGBA{0x00, 0x00, 0x00, 0xff},
	},
	Disabled: &Style{
		BackgroundColor: color.RGBA{0x88, 0x88, 0x88, 0xff},
		ForegroundColor: color.RGBA{0x00, 0x00, 0x00, 0xff},
	},
	Hover: &Style{
		BackgroundColor: color.RGBA{0x3f, 0x3f, 0x3f, 0xff},
		ForegroundColor: color.RGBA{0x3f, 0x3f, 0x3f, 0xff},
	},
	Pressed: &Style{
		BackgroundColor: color.RGBA{0x64, 0x64, 0x64, 0xff},
		ForegroundColor: color.RGBA{0xff, 0xff, 0xff, 0xff},
	},
}
View Source
var LightStyleState = StyleState{
	Idle: Style{
		BackgroundColor: color.RGBA{0xaa, 0xaa, 0xaa, 0xaa},
		ForegroundColor: color.RGBA{0xff, 0xff, 0xff, 0xff},
	},
	Disabled: &Style{
		BackgroundColor: color.RGBA{0x88, 0x88, 0x88, 0xff},
		ForegroundColor: color.RGBA{0xff, 0xff, 0xff, 0xff},
	},
	Hover: &Style{
		BackgroundColor: color.RGBA{0x3f, 0x3f, 0x3f, 0xff},
		ForegroundColor: color.RGBA{0xff, 0xff, 0xff, 0xff},
	},
	Pressed: &Style{
		BackgroundColor: color.RGBA{0x64, 0x64, 0x64, 0xff},
		ForegroundColor: color.RGBA{0xff, 0xff, 0xff, 0xff},
	},
}

Functions

This section is empty.

Types

type Style

type Style struct {
	BackgroundColor color.RGBA        `yaml:"bg_color"`
	ForegroundColor color.RGBA        `yaml:"fg_color"`
	Image           *eimage.NineSlice `yaml:"image"`
}

Style represents the style data for a widget.

type StyleState

type StyleState struct {
	Idle       Style                  `yaml:"idle"`
	Disabled   *Style                 `yaml:"disabled"`
	Hover      *Style                 `yaml:"hover"`
	Pressed    *Style                 `yaml:"pressed"`
	CustomData map[string]interface{} `yaml:"custom_data"`
	Font       *text.Face             `yaml:"-"`
}

StyleState represents the style state data for a widget.

type Theme

type Theme struct {
	ButtonStyle            StyleState `yaml:"button"`
	LabelStyle             StyleState `yaml:"label"`
	TextStyle              StyleState `yaml:"text"`
	ProgressBarStyle       StyleState `yaml:"progressbar"`
	TextInputStyle         StyleState `yaml:"textinput"`
	ContainerStyle         StyleState `yaml:"container"`
	ScrollContainerStyle   StyleState `yaml:"scrollcontainer"`
	CaretStyle             StyleState `yaml:"caret"`
	GraphicStyle           StyleState `yaml:"graphic"`
	ListStyle              StyleState `yaml:"list"`
	CheckboxStyle          StyleState `yaml:"checkbox"`
	SelectComboButtonStyle StyleState `yaml:"selectcombobutton"`

	Font text.Face `yaml:"-"`
}

Theme represents the theme data for EbitenUI.

func NewTheme

func NewTheme(font text.Face) *Theme

NewTheme creates a new theme with the given font. On Linux the theme is determined by the system theme, i.e. light or dark. On Linux, the theme is defaulted to dark if the system theme is undetermined.

func (*Theme) Button

func (th *Theme) Button(text string) []widget.ButtonOpt

Button returns the button options for the theme.

func (*Theme) Caret

func (th *Theme) Caret() []widget.CaretOpt

Caret returns the caret options for the theme.

func (*Theme) Checkbox

func (th *Theme) Checkbox() []widget.CheckboxOpt

func (*Theme) Container

func (th *Theme) Container() []widget.ContainerOpt

Container returns the container options for the theme.

func (*Theme) Graphic

func (th *Theme) Graphic(img *ebiten.Image) []widget.GraphicOpt

func (*Theme) Label

func (th *Theme) Label(text string) []widget.LabelOpt

Label returns the label options for the theme.

func (*Theme) List

func (th *Theme) List() []widget.ListOpt

func (*Theme) ProgressBar

func (th *Theme) ProgressBar() []widget.ProgressBarOpt

ProgressBar returns the progress bar options for the theme.

func (*Theme) SelectComboButton

func (th *Theme) SelectComboButton() widget.SelectComboButtonOpt

func (*Theme) SelectComboButtonWithButtonTheme

func (th *Theme) SelectComboButtonWithButtonTheme() widget.SelectComboButtonOpt

func (*Theme) Text

func (th *Theme) Text(text string) []widget.TextOpt

Text returns the text options for the theme.

func (*Theme) TextInput

func (th *Theme) TextInput() []widget.TextInputOpt

TextInput returns the text input options for the theme.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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