Documentation ¶
Overview ¶
Package theme provides a data-driven theme implementation.
Index ¶
- type Attr
- type AttrAlign
- type AttrBorder
- type AttrColor
- type AttrDotColor
- type AttrFace
- type AttrGap
- type AttrMinimumSize
- type AttrPadding
- type AttrSet
- type AttrTextColor
- type AttrTexture
- type IconTheme
- type Rule
- type Theme
- func (this *Theme) Apply(object tomo.Object, role theme.Role) event.Cookie
- func (this *Theme) Close() error
- func (this *Theme) Icon(icon theme.Icon, size theme.IconSize) canvas.Texture
- func (this *Theme) MimeIcon(mime data.Mime, size theme.IconSize) canvas.Texture
- func (this *Theme) RGBA(c theme.Color) (r, g, b, a uint32)
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 AttrDotColor ¶
AttrDotColor sets the text selection color, if the Object is a TextBox.
type AttrMinimumSize ¶
AttrMinimumSize sets the minimum size 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 (*AttrSet) MergeOver ¶
MergeOver takes attributes from another set and adds them, overriding this one.
func (*AttrSet) MergeUnder ¶
MergeUnder takes attributes from another set and adds them if they don't already exist in this one.
type AttrTextColor ¶
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) Close ¶
Close closes all cached textures this theme has open. Do not call this while the theme is in use.