style

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrSet

type AttrSet map[tomo.AttrKind]tomo.Attr

AttrSet is a set of attributes wherein only one/zero of each attribute type can exist. It is keyed by the AttrKind of each attribute and must not be modified directly.

func AS

func AS(attrs ...tomo.Attr) AttrSet

AS builds an AttrSet out of a vararg list of Attr values. If multiple Attrs of the same kind are specified, the last one will override the others.

func (AttrSet) Add

func (this AttrSet) Add(attrs ...tomo.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 FaceSet

type FaceSet interface {
	// Face returns the font face which most closely matches the given
	// tomo.Face. The face must be closed when it is done being used. If no
	// suitable face could be found, This behavior must return a fallback
	// face (such as basicfont.Face7x13) instead of nil.
	Face(tomo.Face) font.Face
}

FaceSet holds a set of font faces.

type IconSet

type IconSet interface {

	// Icon returns a texture of the corresponding icon ID. If there is no
	// suitable option, it should return nil.
	Icon(tomo.Icon, tomo.IconSize) canvas.Texture

	// MimeIcon returns a texture of an icon corresponding to a MIME type.
	// If there is no suitable specific option, it should return a more
	// generic icon or a plain file icon.
	MimeIcon(data.Mime, tomo.IconSize) canvas.Texture
}

IconSet holds a set of icon textures.

type Rule

type Rule struct {
	Role tomo.Role
	Tags []string
	Set  AttrSet
}

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

func Ru

func Ru(set AttrSet, role tomo.Role, tags ...string) Rule

Ru is shorthand for creating a rule structure

type Style

type Style struct {
	// Rules determines which styles get applied to which Objects.
	Rules []Rule

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

Style can apply a visual style to different objects.

Jump to

Keyboard shortcuts

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