theme

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package theme provides a data-driven theme implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attr

type Attr interface {
	// contains filtered or unexported methods
}

Attr modifies one thing about an Objects's style.

type AttrAlign

type AttrAlign struct{ X, Y tomo.Align }

AttrAlign sets the alignment, if the Object is a ContentBox.

type AttrBorder

type AttrBorder []tomo.Border

AttrBorder sets the border of an Objects.

type AttrColor

type AttrColor struct{ color.Color }

AttrColor sets the background color of an Objects.

type AttrDotColor

type AttrDotColor struct{ color.Color }

AttrDotColor sets the text selection color, if the Object is a TextBox.

type AttrFace

type AttrFace struct{ font.Face }

AttrFace sets the font face, if the Object is a TextBox.

type AttrGap

type AttrGap image.Point

AttrGap sets the gap between child Objects, if the Object is a ContainerBox.

type AttrMinimumSize

type AttrMinimumSize image.Point

AttrMinimumSize sets the minimum size of an Objects.

type AttrPadding

type AttrPadding tomo.Inset

AttrPadding sets the inner padding of an Objects.

type AttrSet

type AttrSet struct {
	// contains filtered or unexported fields
}

AttrSet is a set of attributes wherein only one/zero of each attribute type can exist. I deserve to be imprisoned for the way I made this work (look in attribute.go). Its zero value can be used safely, and you can copy it if you want, but it will point to the same set of attributes.

func AS

func AS(attrs ...Attr) AttrSet

AS builds an AttrSet out of a vararg list of Attr values.

func (*AttrSet) Add

func (this *AttrSet) Add(attrs ...Attr)

Add adds attributes to the set.

func (*AttrSet) MergeOver

func (this *AttrSet) MergeOver(other AttrSet)

MergeOver takes attributes from another set and adds them, overriding this one.

func (*AttrSet) MergeUnder

func (this *AttrSet) MergeUnder(other AttrSet)

MergeUnder takes attributes from another set and adds them if they don't already exist in this one.

type AttrTextColor

type AttrTextColor struct{ color.Color }

AttrTextColor sets the text color, if the Object is a TextBox.

type AttrTexture

type AttrTexture string

AttrTexture sets the texture of an Objects to a named texture.

type IconTheme

type IconTheme interface {
	// Icon returns a texture of the corresponding icon ID.
	Icon(theme.Icon, theme.IconSize) canvas.Texture
	// MimeIcon returns an icon corresponding to a MIME type.
	MimeIcon(data.Mime, theme.IconSize) canvas.Texture
}

IconTheme implements the part of theme.Theme that handles icons.

type Rule

type Rule struct {
	Role    theme.Role
	Default AttrSet
	Hovered AttrSet
	Pressed AttrSet
	Focused AttrSet
}

Rule describes under what circumstances should certain style attributes be active.

type Theme

type Theme struct {
	// Textures maps texture names to image textures.
	Textures map[string]image.Image

	// Rules determines which styles get applied to which Objects.
	Rules []Rule

	// Colors maps theme.Color values to color.RGBA values.
	Colors map[theme.Color]color.Color

	// This type does not handle icons, and as such, a special icon theme
	// must be separately specified.
	IconTheme
	// contains filtered or unexported fields
}

Theme allows the use of data to define a visual style.

func (*Theme) Apply

func (this *Theme) Apply(object tomo.Object, role theme.Role) event.Cookie

func (*Theme) Close

func (this *Theme) Close() error

Close closes all cached textures this theme has open. Do not call this while the theme is in use.

func (*Theme) Icon

func (this *Theme) Icon(icon theme.Icon, size theme.IconSize) canvas.Texture

func (*Theme) MimeIcon

func (this *Theme) MimeIcon(mime data.Mime, size theme.IconSize) canvas.Texture

func (*Theme) RGBA

func (this *Theme) RGBA(c theme.Color) (r, g, b, a uint32)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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