This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
tomo-old/theme/theme.go

241 lines
5.1 KiB
Go
Raw Normal View History

2023-01-09 06:03:19 +00:00
package theme
2023-02-03 05:57:18 +00:00
import "image"
import "image/color"
2023-01-09 06:03:19 +00:00
import "golang.org/x/image/font"
2023-03-04 21:18:43 +00:00
import "git.tebibyte.media/sashakoshka/tomo/data"
2023-01-09 06:03:19 +00:00
import "git.tebibyte.media/sashakoshka/tomo/artist"
// IconSize is a type representing valid icon sizes.
type IconSize int
const (
IconSizeSmall IconSize = 16
IconSizeLarge IconSize = 48
)
2023-01-09 06:03:19 +00:00
2023-02-03 05:57:18 +00:00
// Pattern lists a number of cannonical pattern types, each with its own ID.
type Pattern int; const (
2023-02-27 03:20:17 +00:00
// PatternBackground is the window background of the theme. It appears
// in things like containers and behind text.
PatternBackground Pattern = iota
2023-02-03 05:57:18 +00:00
// PatternDead is a pattern that is displayed on a "dead area" where no
// controls exist, but there still must be some indication of visual
// structure (such as in the corner between two scroll bars).
PatternDead
// PatternRaised is a generic raised pattern.
PatternRaised
// PatternSunken is a generic sunken pattern.
PatternSunken
// PatternPinboard is similar to PatternSunken, but it is textured.
PatternPinboard
// PatternButton is a button pattern.
PatternButton
// PatternInput is a pattern for input fields, editable text areas, etc.
PatternInput
// PatternGutter is a track for things to slide on.
PatternGutter
// PatternHandle is a handle that slides along a gutter.
PatternHandle
// PatternLine is an engraved line that separates things.
PatternLine
2023-03-01 00:00:34 +00:00
// PatternMercury is a fill pattern for progress bars, meters, etc.
PatternMercury
2023-02-03 05:57:18 +00:00
)
2023-03-05 01:10:53 +00:00
// Color lits a number of cannonical colors, each with its own ID.
2023-02-27 03:20:17 +00:00
type Color int; const (
// ColorAccent is the accent color of the theme.
ColorAccent Color = iota
// ColorForeground is the text/icon color of the theme.
ColorForeground
)
2023-03-05 01:10:53 +00:00
// Icon lists a number of cannonical icons, each with its own ID.
type Icon int; const (
// IconNone specifies no icon.
IconNone = -1
2023-03-05 01:10:53 +00:00
// Place icons
IconHome Icon = iota
Icon3DObjects
IconPictures
IconVideos
IconMusic
IconArchives
IconBooks
IconDocuments
IconFonts
IconPrograms
IconLibraries
IconDownloads
IconRepositories
2023-03-05 03:07:59 +00:00
IconSettings)
2023-03-05 01:10:53 +00:00
2023-03-05 03:07:59 +00:00
const (
2023-03-05 01:10:53 +00:00
// Object icons
2023-03-05 03:07:59 +00:00
IconFile Icon = iota + 0x80
2023-03-05 01:10:53 +00:00
IconDirectory
IconPopulatedDirectory
IconStorage
IconMagneticTape
IconFloppyDisk
IconHDD
IconSSD
IconFlashDrive
IconMemoryCard
IconRomDisk
IconRamDisk
IconCD
IconDVD
IconNetwork
IconInternet
IconDevice
IconServer
IconNetworkSwitch
IconRouter
IconDesktop
IconLaptop
IconTablet
IconPhone
IconCamera
IconPeripheral
IconKeyboard
IconMouse
IconTrackpad
IconPenTablet
IconMonitor
IconSpeaker
IconMicrophone
IconWebcam
IconGameController
IconPort
IconNetworkPort
IconUSBPort
IconParallelPort
IconSerialPort
IconPS2Port
2023-03-05 03:07:59 +00:00
IconMonitorPort)
2023-03-05 01:10:53 +00:00
2023-03-05 03:07:59 +00:00
const (
2023-03-05 01:10:53 +00:00
// Action icons
2023-03-05 04:09:46 +00:00
IconOpen Icon = iota + 0x100
2023-03-05 01:10:53 +00:00
IconSave
IconSaveAs
IconNew
IconNewFolder
IconDelete
IconCut
IconCopy
IconPaste
IconAdd
IconRemove
IconAddBookmark
IconRemoveBookmark
IconAddFavorite
IconRemoveFavorite
2023-03-05 01:48:46 +00:00
2023-03-05 01:10:53 +00:00
IconPlay
IconPause
IconStop
IconFastForward
IconRewind
IconToEnd
IconToBeginning
IconRecord
IconVolumeUp
IconVolumeDown
IconMute
IconBackward
IconForward
IconRefresh
IconHistory
IconYes
IconNo
IconUpward)
2023-03-05 01:10:53 +00:00
2023-03-05 03:07:59 +00:00
const (
2023-03-05 01:10:53 +00:00
// Status icons
2023-03-05 04:09:46 +00:00
IconInformation Icon = iota + 0x180
2023-03-05 01:10:53 +00:00
IconQuestion
IconWarning
2023-03-05 03:07:59 +00:00
IconError)
2023-03-05 01:10:53 +00:00
2023-03-05 03:07:59 +00:00
const (
2023-03-05 01:10:53 +00:00
// Tool icons
2023-03-05 03:07:59 +00:00
)
2023-03-05 01:10:53 +00:00
// Hints specifies rendering hints for a particular pattern. Elements can take
// these into account in order to gain extra performance.
type Hints struct {
// StaticInset defines an inset rectangular area in the middle of the
// pattern that does not change between PatternStates. If the inset is
// zero on all sides, this hint does not apply.
StaticInset artist.Inset
// Uniform specifies a singular color for the entire pattern. If the
// alpha channel is zero, this hint does not apply.
Uniform color.RGBA
}
2023-02-03 05:57:18 +00:00
// Theme represents a visual style configuration,
type Theme interface {
// FontFace returns the proper font for a given style, size, and case.
FontFace (FontStyle, FontSize, Case) font.Face
// Icon returns an appropriate icon given an icon name, size, and case.
2023-03-05 03:07:59 +00:00
Icon (Icon, IconSize, Case) artist.Icon
2023-03-04 21:18:43 +00:00
// Icon returns an appropriate icon given a file mime type, size, and,
// case.
2023-03-05 01:48:46 +00:00
MimeIcon (data.Mime, IconSize, Case) artist.Icon
2023-02-03 05:57:18 +00:00
// Pattern returns an appropriate pattern given a pattern name, case,
// and state.
2023-02-27 03:20:17 +00:00
Pattern (Pattern, State, Case) artist.Pattern
// Color returns an appropriate pattern given a color name, case, and
// state.
Color (Color, State, Case) color.RGBA
2023-02-03 05:57:18 +00:00
// Padding returns how much space should be between the bounds of a
// pattern whatever an element draws inside of it.
Padding (Pattern, Case) artist.Inset
// Margin returns the left/right (x) and top/bottom (y) margins that
// should be put between any self-contained objects drawn within this
// pattern (if applicable).
Margin (Pattern, Case) image.Point
2023-01-09 06:03:19 +00:00
2023-02-03 05:57:18 +00:00
// Sink returns a vector that should be added to an element's inner
// content when it is pressed down (if applicable) to simulate a 3D
// sinking effect.
Sink (Pattern, Case) image.Point
// Hints returns rendering optimization hints for a particular pattern.
// These are optional, but following them may result in improved
// performance.
Hints (Pattern, Case) Hints
2023-01-09 06:03:19 +00:00
}