Documentation
¶
Overview ¶
Package iconTheme implements icon-theme-spec version 0.13.
Index ¶
Constants ¶
const ( // ErrThemeNotFound indicates that a theme could not be found. ErrThemeNotFound = iconThemeError("theme not found") // ErrGroupMissing indicates that a required group was not found in an // index.theme file. ErrGroupMissing = iconThemeError("group missing") // ErrIconThemeGroupMissing indicates that the [Icon Theme] group was // not found while parsing an index.theme file. ErrIconThemeGroupMissing = iconThemeError("icon theme group missing") // ErrDirectoryGroupMissing indicates that a directory group was not // found while parsing an index.Theme file. ErrDirectoryGroupMissing = iconThemeError("directory group missing") // ErrEntryMissing indicates that a required entry was not found in an // index.theme file. ErrEntryMissing = iconThemeError("entry missing") // ErrBadIconSizeType indicates that an invalid value for an icon size // type was given. ErrBadIconSizeType = iconThemeError("bad icon size type") // ErrCircularDependency indicates that an icon theme depends on one of // its dependents. ErrCircularDependency = iconThemeError("circular dependency") // ErrIconNotFound indicates that an icon could not be found. ErrIconNotFound = iconThemeError("icon not found") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Directory ¶
type Directory struct { Name string Paths []string Size int Scale int Context string Type IconSizeType MaxSize int MinSize int Threshold int }
Directory represents a directory of an icon theme which directly contains icons.
func (Directory) SizeDistance ¶
SizeDistance returns how close the size of this directory's icons is to the given size. A smaller number is closer.
type Icon ¶
type Icon struct { Path string FileType IconFileType DisplayName keyValue.Entry EmbeddedTextRectangle image.Rectangle AttachPoints []image.Point }
Icon represents an icon, and its associated data (if applicable).
type IconFileType ¶
type IconFileType uint
IconFileType specifies the file type of an icon.
const ( PNG IconFileType = iota SVG XPM )
func (IconFileType) Extend ¶
func (ty IconFileType) Extend(name string) string
Extend applies the file extension to a file name.
func (IconFileType) String ¶
func (ty IconFileType) String() string
String returns a string representation of the file type.
type IconSizeType ¶
type IconSizeType int
IconSizeType specifies how an icon can be scaled. Fixed icons cannot be scaled, scalable icons can be scaled to any size within a min and max range, and threshold icons can be scaled to any size within a certain distance of their normal size.
const ( IconSizeTypeFixed IconSizeType = iota IconSizeTypeScalable IconSizeTypeThreshold )
func IconSizeTypeFromString ¶
func IconSizeTypeFromString(value string) (IconSizeType, error)
IconSizeTypeFromString converts a astring into an IconSizeType, returning an error if it could not be converted.
func (IconSizeType) String ¶
func (ty IconSizeType) String() string
String returns a string representation of the type.
type Theme ¶
type Theme struct { Name keyValue.Entry Comment keyValue.Entry Inherits []Theme Directories []Directory ScaledDirectories []Directory Hidden bool Example string }
Theme represents an icon theme.
func FindTheme ¶
FindTheme returns the theme of the given name located within the given search paths. If no search path is provided, the result of ThemeDirs is used. This function will also recursively find and read inherited themes. If an inherited theme is malformed and cannot be read, hicolor will be used instead. The directory structure and inheritence tree of a theme are only determined when this function is run, if a theme has been changed and needs to be reloaded this function should be called again.
func FindThemeWarn ¶
FindThemeWarn is like FindTheme, but emits warnings using the log package if it encounters a recoverable error (such as failing to parse/find an inherited theme).