Documentation ¶
Index ¶
- Variables
- func DrawCross(dc *gg.Context, x, y, size float64, color color.Color)
- func DrawLine(dc *gg.Context, x, y, size float64, color color.Color)
- func DrawSquare(dc *gg.Context, x, y, size float64, color color.Color)
- func DrawTitleText(dc *gg.Context, title string, width, titleBarHeight int, textColor color.Color, ...) error
- func DrawWindowBase(dc *gg.Context, width int, height int, cornerRadius float64, ...) error
- type BlankChrome
- func (c *BlankChrome) ContentInsets() (top, right, bottom, left int)
- func (c *BlankChrome) CurrentTheme() Theme
- func (c *BlankChrome) GetCurrentThemeName() string
- func (c *BlankChrome) GetCurrentVariant() ThemeVariant
- func (c *BlankChrome) MinimumSize() (width, height int)
- func (c *BlankChrome) Render(content image.Image) (image.Image, error)
- func (c *BlankChrome) WithCornerRadius(radius float64) Chrome
- func (c *BlankChrome) WithTheme(theme Theme) Chrome
- func (c *BlankChrome) WithThemeByName(name string, variant ThemeVariant) Chrome
- func (c *BlankChrome) WithTitle(_ string) Chrome
- func (c *BlankChrome) WithTitleBar(_ bool) Chrome
- func (c *BlankChrome) WithVariant(variant ThemeVariant) Chrome
- type Chrome
- type ChromeOption
- type GNOMEChrome
- func (c *GNOMEChrome) ContentInsets() (top, right, bottom, left int)
- func (c *GNOMEChrome) CurrentTheme() Theme
- func (c *GNOMEChrome) GetCurrentThemeName() string
- func (c *GNOMEChrome) GetCurrentVariant() ThemeVariant
- func (c *GNOMEChrome) MinimumSize() (width, height int)
- func (c *GNOMEChrome) Render(content image.Image) (image.Image, error)
- func (c *GNOMEChrome) WithCornerRadius(radius float64) Chrome
- func (c *GNOMEChrome) WithTheme(theme Theme) Chrome
- func (c *GNOMEChrome) WithThemeByName(name string, variant ThemeVariant) Chrome
- func (c *GNOMEChrome) WithTitle(title string) Chrome
- func (c *GNOMEChrome) WithTitleBar(enabled bool) Chrome
- func (c *GNOMEChrome) WithVariant(variant ThemeVariant) Chrome
- type GNOMEStyle
- type MacChrome
- func (c *MacChrome) ContentInsets() (top, right, bottom, left int)
- func (c *MacChrome) CurrentTheme() Theme
- func (c *MacChrome) GetCurrentThemeName() string
- func (c *MacChrome) GetCurrentVariant() ThemeVariant
- func (c *MacChrome) MinimumSize() (width, height int)
- func (c *MacChrome) Render(content image.Image) (image.Image, error)
- func (c *MacChrome) WithCornerRadius(radius float64) Chrome
- func (c *MacChrome) WithTheme(theme Theme) Chrome
- func (c *MacChrome) WithThemeByName(name string, variant ThemeVariant) Chrome
- func (c *MacChrome) WithTitle(title string) Chrome
- func (c *MacChrome) WithTitleBar(enabled bool) Chrome
- func (c *MacChrome) WithVariant(variant ThemeVariant) Chrome
- type MacStyle
- type Theme
- type ThemeProperties
- type ThemeRegistry
- type ThemeType
- type ThemeVariant
- type WindowStyle
- type WindowsChrome
- func (c *WindowsChrome) ContentInsets() (top, right, bottom, left int)
- func (c *WindowsChrome) CurrentTheme() Theme
- func (c *WindowsChrome) GetCurrentThemeName() string
- func (c *WindowsChrome) GetCurrentVariant() ThemeVariant
- func (c *WindowsChrome) MinimumSize() (width, height int)
- func (c *WindowsChrome) Render(content image.Image) (image.Image, error)
- func (c *WindowsChrome) WithCornerRadius(radius float64) Chrome
- func (c *WindowsChrome) WithTheme(theme Theme) Chrome
- func (c *WindowsChrome) WithThemeByName(name string, variant ThemeVariant) Chrome
- func (c *WindowsChrome) WithTitle(title string) Chrome
- func (c *WindowsChrome) WithTitleBar(enabled bool) Chrome
- func (c *WindowsChrome) WithVariant(variant ThemeVariant) Chrome
- type WindowsStyle
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = NewThemeRegistry()
DefaultRegistry is the default theme registry
Functions ¶
func DrawSquare ¶
DrawSquare draws a square symbol for the maximize button
Types ¶
type BlankChrome ¶ added in v0.4.0
type BlankChrome struct {
// contains filtered or unexported fields
}
BlankChrome implements the Chrome interface with minimal decoration
func NewBlankChrome ¶ added in v0.4.0
func NewBlankChrome(opts ...ChromeOption) *BlankChrome
NewBlankChrome creates a new blank window chrome
func (*BlankChrome) ContentInsets ¶ added in v0.4.0
func (c *BlankChrome) ContentInsets() (top, right, bottom, left int)
func (*BlankChrome) CurrentTheme ¶ added in v0.4.0
func (c *BlankChrome) CurrentTheme() Theme
func (*BlankChrome) GetCurrentThemeName ¶ added in v0.4.0
func (c *BlankChrome) GetCurrentThemeName() string
func (*BlankChrome) GetCurrentVariant ¶ added in v0.4.0
func (c *BlankChrome) GetCurrentVariant() ThemeVariant
func (*BlankChrome) MinimumSize ¶ added in v0.4.0
func (c *BlankChrome) MinimumSize() (width, height int)
func (*BlankChrome) WithCornerRadius ¶ added in v0.7.0
func (c *BlankChrome) WithCornerRadius(radius float64) Chrome
func (*BlankChrome) WithTheme ¶ added in v0.7.0
func (c *BlankChrome) WithTheme(theme Theme) Chrome
func (*BlankChrome) WithThemeByName ¶ added in v0.7.0
func (c *BlankChrome) WithThemeByName(name string, variant ThemeVariant) Chrome
func (*BlankChrome) WithTitle ¶ added in v0.7.0
func (c *BlankChrome) WithTitle(_ string) Chrome
func (*BlankChrome) WithTitleBar ¶ added in v0.7.0
func (c *BlankChrome) WithTitleBar(_ bool) Chrome
func (*BlankChrome) WithVariant ¶ added in v0.7.0
func (c *BlankChrome) WithVariant(variant ThemeVariant) Chrome
type Chrome ¶
type Chrome interface { Render(content image.Image) (image.Image, error) WithTitle(title string) Chrome WithCornerRadius(radius float64) Chrome WithTitleBar(enabled bool) Chrome WithTheme(theme Theme) Chrome WithThemeByName(name string, variant ThemeVariant) Chrome WithVariant(variant ThemeVariant) Chrome GetCurrentThemeName() string GetCurrentVariant() ThemeVariant CurrentTheme() Theme MinimumSize() (width, height int) ContentInsets() (top, right, bottom, left int) }
Chrome defines the interface for window chrome implementations
type ChromeOption ¶
ChromeOption is a function that modifies a Chrome instance
func WithCornerRadius ¶
func WithCornerRadius(radius float64) ChromeOption
WithCornerRadius sets the corner radius
func WithThemeByName ¶ added in v0.3.0
func WithThemeByName(name string, variant ThemeVariant) ChromeOption
WithThemeByName sets the theme by name and variant
func WithTitleBar ¶
func WithTitleBar(enabled bool) ChromeOption
WithTitleBar enables or disables the title bar
func WithVariant ¶ added in v0.3.0
func WithVariant(variant ThemeVariant) ChromeOption
WithVariant sets the theme variant
type GNOMEChrome ¶ added in v0.3.0
type GNOMEChrome struct {
// contains filtered or unexported fields
}
GNOMEChrome implements the Chrome interface with GNOME-style window decorations
func NewGNOMEChrome ¶ added in v0.3.0
func NewGNOMEChrome(style GNOMEStyle, opts ...ChromeOption) *GNOMEChrome
NewGNOMEChrome creates a new GNOME-style window chrome
func (*GNOMEChrome) ContentInsets ¶ added in v0.3.0
func (c *GNOMEChrome) ContentInsets() (top, right, bottom, left int)
func (*GNOMEChrome) CurrentTheme ¶ added in v0.3.0
func (c *GNOMEChrome) CurrentTheme() Theme
func (*GNOMEChrome) GetCurrentThemeName ¶ added in v0.3.0
func (c *GNOMEChrome) GetCurrentThemeName() string
func (*GNOMEChrome) GetCurrentVariant ¶ added in v0.3.0
func (c *GNOMEChrome) GetCurrentVariant() ThemeVariant
func (*GNOMEChrome) MinimumSize ¶ added in v0.3.0
func (c *GNOMEChrome) MinimumSize() (width, height int)
func (*GNOMEChrome) WithCornerRadius ¶ added in v0.7.0
func (c *GNOMEChrome) WithCornerRadius(radius float64) Chrome
func (*GNOMEChrome) WithTheme ¶ added in v0.7.0
func (c *GNOMEChrome) WithTheme(theme Theme) Chrome
func (*GNOMEChrome) WithThemeByName ¶ added in v0.7.0
func (c *GNOMEChrome) WithThemeByName(name string, variant ThemeVariant) Chrome
func (*GNOMEChrome) WithTitle ¶ added in v0.7.0
func (c *GNOMEChrome) WithTitle(title string) Chrome
func (*GNOMEChrome) WithTitleBar ¶ added in v0.7.0
func (c *GNOMEChrome) WithTitleBar(enabled bool) Chrome
func (*GNOMEChrome) WithVariant ¶ added in v0.7.0
func (c *GNOMEChrome) WithVariant(variant ThemeVariant) Chrome
type GNOMEStyle ¶ added in v0.3.0
type GNOMEStyle string
GNOMEStyle represents different GNOME UI styles
const ( GNOMEStyleAdwaita GNOMEStyle = "adwaita" // Adwaita style GNOMEStyleBreeze GNOMEStyle = "breeze" // Breeze style )
type MacChrome ¶ added in v0.3.0
type MacChrome struct {
// contains filtered or unexported fields
}
MacChrome implements the Chrome interface with macOS-style window decorations
func NewMacChrome ¶ added in v0.3.0
func NewMacChrome(style MacStyle, opts ...ChromeOption) *MacChrome
NewMacChrome creates a new macOS-style window chrome
func (*MacChrome) ContentInsets ¶ added in v0.3.0
func (*MacChrome) CurrentTheme ¶ added in v0.3.0
func (*MacChrome) GetCurrentThemeName ¶ added in v0.3.0
func (*MacChrome) GetCurrentVariant ¶ added in v0.3.0
func (c *MacChrome) GetCurrentVariant() ThemeVariant
func (*MacChrome) MinimumSize ¶ added in v0.3.0
func (*MacChrome) WithCornerRadius ¶ added in v0.7.0
func (*MacChrome) WithThemeByName ¶ added in v0.7.0
func (c *MacChrome) WithThemeByName(name string, variant ThemeVariant) Chrome
func (*MacChrome) WithTitleBar ¶ added in v0.7.0
func (*MacChrome) WithVariant ¶ added in v0.7.0
func (c *MacChrome) WithVariant(variant ThemeVariant) Chrome
type MacStyle ¶ added in v0.3.0
type MacStyle string
MacStyle represents different macOS UI styles
const ( MacStyleSequoia MacStyle = "sequoia" // macOS 15 MacStyleSonoma MacStyle = "sonoma" // macOS 14 MacStyleVentura MacStyle = "ventura" // macOS 13 MacStyleMonterey MacStyle = "monterey" // macOS 12 MacStyleBigSur MacStyle = "bigsur" // macOS 11 MacStyleCatalina MacStyle = "catalina" // macOS 10.15 MacStyleMojave MacStyle = "mojave" // macOS 10.14 MacStyleHighSierra MacStyle = "highsierra" // macOS 10.13 MacStyleSierra MacStyle = "sierra" // macOS 10.12 MacStyleElCapitan MacStyle = "elcapitan" // OS X 10.11 MacStyleYosemite MacStyle = "yosemite" // OS X 10.10 MacStyleMavericks MacStyle = "mavericks" // OS X 10.9 MacStyleMountainLion MacStyle = "mountainlion" // OS X 10.8 MacStyleLion MacStyle = "lion" // OS X 10.7 MacStyleSnowLeopard MacStyle = "snowleopard" // Mac OS X 10.6 )
type Theme ¶
type Theme struct { Type ThemeType Variant ThemeVariant Name string Properties ThemeProperties }
Theme represents a complete window chrome theme
type ThemeProperties ¶ added in v0.3.0
type ThemeProperties struct { // Basic properties TitleFont string TitleText color.Color TitleFontSize float64 TitleBackground color.Color ControlsColor color.Color ContentBackground color.Color TextColor color.Color // Extended properties for different window managers AccentColor color.Color // Primary accent color BorderColor color.Color // Window border color InactiveTitleBg color.Color // Title bar background when window is inactive InactiveTitleText color.Color // Title text color when window is inactive ButtonHoverColor color.Color // Button hover state color ButtonPressedColor color.Color // Button pressed state color CornerRadius float64 // Window corner radius BorderWidth float64 // Window border width CustomProperties map[string]any // Additional theme-specific properties }
ThemeProperties contains the visual properties of a theme
type ThemeRegistry ¶ added in v0.3.0
type ThemeRegistry struct {
// contains filtered or unexported fields
}
ThemeRegistry maintains a registry of available themes
func NewThemeRegistry ¶ added in v0.3.0
func NewThemeRegistry() *ThemeRegistry
NewThemeRegistry creates a new theme registry
func (*ThemeRegistry) GetTheme ¶ added in v0.3.0
func (r *ThemeRegistry) GetTheme(themeType ThemeType, name string, variant ThemeVariant) (Theme, bool)
GetTheme retrieves a theme from the registry
func (*ThemeRegistry) GetThemeNames ¶ added in v0.3.0
func (r *ThemeRegistry) GetThemeNames(themeType ThemeType) []string
GetThemeNames returns all registered theme names for a given type
func (*ThemeRegistry) RegisterTheme ¶ added in v0.3.0
func (r *ThemeRegistry) RegisterTheme(themeType ThemeType, name string, variant ThemeVariant, theme Theme)
RegisterTheme registers a theme with the registry
type ThemeType ¶ added in v0.3.0
type ThemeType string
ThemeType represents the type of window chrome theme
type ThemeVariant ¶ added in v0.3.0
type ThemeVariant string
ThemeVariant represents a variant of a theme (e.g., light or dark)
const ( ThemeVariantLight ThemeVariant = "light" ThemeVariantDark ThemeVariant = "dark" )
type WindowStyle ¶
type WindowStyle int
WindowStyle represents the style of window controls (macOS, Windows, etc)
const ( // MacOSStyle represents macOS-style window controls MacOSStyle WindowStyle = iota // Windows11Style represents Windows 11-style window controls Windows11Style )
type WindowsChrome ¶ added in v0.3.0
type WindowsChrome struct {
// contains filtered or unexported fields
}
WindowsChrome implements the Chrome interface with Windows-style window decorations
func NewWindowsChrome ¶ added in v0.3.0
func NewWindowsChrome(style WindowsStyle, opts ...ChromeOption) *WindowsChrome
NewWindowsChrome creates a new Windows-style window chrome
func (*WindowsChrome) ContentInsets ¶ added in v0.3.0
func (c *WindowsChrome) ContentInsets() (top, right, bottom, left int)
func (*WindowsChrome) CurrentTheme ¶ added in v0.3.0
func (c *WindowsChrome) CurrentTheme() Theme
func (*WindowsChrome) GetCurrentThemeName ¶ added in v0.3.0
func (c *WindowsChrome) GetCurrentThemeName() string
func (*WindowsChrome) GetCurrentVariant ¶ added in v0.3.0
func (c *WindowsChrome) GetCurrentVariant() ThemeVariant
func (*WindowsChrome) MinimumSize ¶ added in v0.3.0
func (c *WindowsChrome) MinimumSize() (width, height int)
func (*WindowsChrome) WithCornerRadius ¶ added in v0.7.0
func (c *WindowsChrome) WithCornerRadius(radius float64) Chrome
func (*WindowsChrome) WithTheme ¶ added in v0.7.0
func (c *WindowsChrome) WithTheme(theme Theme) Chrome
func (*WindowsChrome) WithThemeByName ¶ added in v0.7.0
func (c *WindowsChrome) WithThemeByName(name string, variant ThemeVariant) Chrome
func (*WindowsChrome) WithTitle ¶ added in v0.7.0
func (c *WindowsChrome) WithTitle(title string) Chrome
func (*WindowsChrome) WithTitleBar ¶ added in v0.7.0
func (c *WindowsChrome) WithTitleBar(enabled bool) Chrome
func (*WindowsChrome) WithVariant ¶ added in v0.7.0
func (c *WindowsChrome) WithVariant(variant ThemeVariant) Chrome
type WindowsStyle ¶ added in v0.3.0
type WindowsStyle string
WindowsStyle represents different Windows UI styles
const ( WindowsStyleWin11 WindowsStyle = "windows11" WindowsStyleWin10 WindowsStyle = "windows10" WindowsStyleWin8 WindowsStyle = "windows8" WindowsStyleWinXP WindowsStyle = "windowsxp" )