theme

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: GPL-3.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(object tomo.Object, role Role) event.Cookie

Apply applies the current theme to the given object, according to the given role. This may register event listeners with the given object; closing the returned cookie will remove them.

func MimeIcon added in v0.24.0

func MimeIcon(mime data.Mime, size IconSize) canvas.Texture

MimeIcon returns an icon corresponding to a MIME type.

func SetTheme

func SetTheme(theme Theme)

SetTheme sets the theme.

Types

type Color added in v0.21.0

type Color int

Color represents a color ID.

const (
	ColorBackground Color = iota
	ColorForeground
	ColorRaised
	ColorSunken
	ColorAccent
)

func (Color) RGBA added in v0.21.0

func (id Color) RGBA() (r, g, b, a uint32)

RGBA satisfies the color.Color interface.

func (Color) String added in v0.27.0

func (c Color) String() string

String satisfies the fmt.Stringer interface.

type Icon added in v0.24.0

type Icon int

Icon represents an icon ID.

const (

	// files
	IconFile Icon = iota
	IconDirectory
	IconDirectoryFull

	// places
	IconDownloads
	IconPhotos
	IconBooks
	IconDocuments
	IconRepositories
	IconMusic
	IconArchives
	IconFonts
	IconBinaries
	IconVideos
	Icon3DObjects
	IconHistory
	IconPreferences

	// storage
	IconStorage // generic
	IconMagneticTape
	IconFloppyDisk
	IconHardDisk
	IconSolidStateDrive
	IconFlashDrive
	IconMemoryCard
	IconROMDisk
	IconRAMDisk
	IconCD
	IconDVD

	// network
	IconNetwork // generic
	IconLocalNetwork
	IconInternet
	IconEthernet
	IconWireless
	IconCell
	IconBluetooth
	IconRadio

	// devices
	IconDevice // generic
	IconRouter
	IconSwitch
	IconServer
	IconDesktop
	IconLaptop
	IconTablet
	IconPhone
	IconWatch
	IconCamera

	// peripherals
	IconPeripheral // generic
	IconKeyboard
	IconMouse
	IconMonitor
	IconWebcam
	IconMicrophone
	IconSpeaker
	IconPenTablet
	IconTrackpad
	IconController

	// i/o
	IconPort // generic
	IconEthernetPort
	IconUSBPort
	IconParallelPort
	IconSerialPort
	IconPS2Port
	IconDisplayConnector
	IconCGAPort
	IconVGAPort
	IconHDMIPort
	IconDisplayPort
	IconInfrared

	// files
	IconOpen
	IconOpenIn
	IconSave
	IconSaveAs
	IconPrint
	IconNew
	IconNewDirectory
	IconDelete
	IconRename
	IconGetInformation
	IconChangePermissions
	IconRevert

	// list management
	IconAdd
	IconRemove
	IconAddBookmark
	IconRemoveBookmark
	IconAddFavorite
	IconRemoveFavorite

	// media
	IconPlay
	IconPause
	IconStop
	IconFastForward
	IconRewind
	IconToBeginning
	IconToEnd
	IconRecord
	IconVolumeUp
	IconVolumeDown
	IconMute

	// editing
	IconUndo
	IconRedo
	IconCut
	IconCopy
	IconPaste
	IconFind
	IconReplace
	IconSelectAll
	IconSelectNone
	IconIncrement
	IconDecrement

	// window management
	IconClose
	IconQuit
	IconIconify
	IconShade
	IconMaximize
	IconFullScreen
	IconRestore

	// view controls
	IconExpand
	IconContract
	IconBack
	IconForward
	IconUp
	IconDown
	IconReload
	IconZoomIn
	IconZoomOut
	IconZoomReset
	IconMove
	IconResize
	IconGoTo

	// tools
	IconTransform
	IconTranslate
	IconRotate
	IconScale
	IconWarp
	IconCornerPin
	IconSelectRectangle
	IconSelectEllipse
	IconSelectLasso
	IconSelectGeometric
	IconSelectAuto
	IconCrop
	IconFill
	IconGradient
	IconPencil
	IconBrush
	IconEraser
	IconText
	IconEyedropper

	// dialogs
	IconInformation
	IconQuestion
	IconWarning
	IconError
	IconCancel
	IconOkay

	// network
	IconCellSignal0
	IconCellSignal1
	IconCellSignal2
	IconCellSignal3
	IconWirelessSignal0
	IconWirelessSignal1
	IconWirelessSignal2
	IconWirelessSignal3

	// power
	IconBattery0
	IconBattery1
	IconBattery2
	IconBattery3
	IconBrightness0
	IconBrightness1
	IconBrightness2
	IconBrightness3

	// media
	IconVolume0
	IconVolume1
	IconVolume2
	IconVolume3
)

func (Icon) String added in v0.27.0

func (id Icon) String() string

String satisfies the fmt.Stringer interface.

func (Icon) Texture added in v0.24.0

func (id Icon) Texture(size IconSize) canvas.Texture

Texture returns a texture of the corresponding icon ID.

type IconSize added in v0.24.0

type IconSize int

IconSize represents the size of an icon.

const (
	IconSizeSmall IconSize = iota
	IconSizeMedium
	IconSizeLarge
)

func (IconSize) String added in v0.27.0

func (size IconSize) String() string

String satisfies the fmt.Stringer interface.

type Role

type Role struct {
	// Package is an optional namespace field. If specified, it should be
	// the package name or module name the object is from.
	Package string

	// Object specifies what type of object it is. For example:
	//   - TextInput
	//   - Table
	//   - Label
	//   - Dial
	// This should correspond directly to the type name of the object.
	Object string

	// Variant is an optional field to be used when an object has one or
	// more soft variants under one type. For example, an object "Slider"
	// may have variations "horizontal" and "vertical".
	Variant string
}

Role describes the role of an object.

func R added in v0.20.0

func R(pack, object, variant string) Role

R is shorthand for creating a Role structure.

func (Role) String added in v0.27.0

func (r Role) String() string

String satisfies the fmt.Stringer interface. It follows the format of: Package.Object[Variant]

type Theme

type Theme interface {

	// Apply applies the theme to the given object, according to the given
	// role. This may register event listeners with the given object;
	// closing the returned cookie must remove them.
	Apply(tomo.Object, Role) event.Cookie

	// RGBA returns the RGBA values of the corresponding color ID.
	RGBA(Color) (r, g, b, a uint32)

	// Icon returns a texture of the corresponding icon ID.
	Icon(Icon, IconSize) canvas.Texture

	// MimeIcon returns an icon corresponding to a MIME type.
	MimeIcon(data.Mime, IconSize) canvas.Texture

	// ApplicationIcon returns an icon corresponding to an application's
	// name. This may return nil if there is no icon for that application.
	ApplicationIcon(string, IconSize) canvas.Texture
}

Theme is an object that 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