Documentation
¶
Overview ¶
Package themeformat provides types and utilities for the markdown theme format.
Index ¶
- Constants
- func DecodeWallpaper(theme *Theme, basePath string) (data []byte, format string, err error)
- func Generate(theme *Theme, includeThumbnail bool, thumbnailData string) (string, error)
- func GenerateThumbnail(imageData []byte, maxWidth, quality int) (string, error)
- func WriteFile(path string, theme *Theme, includeThumbnail bool, thumbnailData string) error
- type Ambience
- type Color
- type Source
- type Theme
- type Thumbnail
- type Wallpaper
Constants ¶
const ( // DefaultThumbnailMaxWidth is the maximum width for thumbnails. DefaultThumbnailMaxWidth = 800 // DefaultThumbnailQuality is the JPEG quality for thumbnails. DefaultThumbnailQuality = 75 )
Variables ¶
This section is empty.
Functions ¶
func DecodeWallpaper ¶
DecodeWallpaper extracts wallpaper bytes from a theme. For embedded wallpapers, decodes the base64 data. For external references, reads from path or URL.
func GenerateThumbnail ¶
GenerateThumbnail creates a smaller preview image from the original. Returns base64-encoded JPEG data.
Types ¶
type Ambience ¶
type Ambience struct {
Hex string `yaml:"hex"`
Region string `yaml:"region"`
Weight float64 `yaml:"weight"`
}
Ambience represents an ambient/edge color.
type Color ¶
type Color struct {
Hex string `yaml:"hex"`
Weight float64 `yaml:"weight"`
Role string `yaml:"role,omitempty"`
}
Color represents a color in the palette.
type Source ¶
type Source struct {
Plugin string `yaml:"plugin"`
Model string `yaml:"model,omitempty"`
Prompt string `yaml:"prompt,omitempty"`
}
Source contains information about how the theme was generated.
type Theme ¶
type Theme struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Generator string `yaml:"generator"`
Generated time.Time `yaml:"generated"`
Source *Source `yaml:"source,omitempty"`
Wallpaper *Wallpaper `yaml:"wallpaper,omitempty"`
Colors []Color `yaml:"colors"`
Ambience []Ambience `yaml:"ambience,omitempty"`
}
Theme represents a complete theme file with metadata, colors, and wallpaper.
type Thumbnail ¶
type Thumbnail struct {
Format string `yaml:"format"`
Width int `yaml:"width"`
Height int `yaml:"height"`
Data string `yaml:"data"` // base64
}
Thumbnail contains a smaller preview image for the markdown body.
type Wallpaper ¶
type Wallpaper struct {
Embedded bool `yaml:"embedded"`
Format string `yaml:"format,omitempty"`
Width int `yaml:"width,omitempty"`
Height int `yaml:"height,omitempty"`
Data string `yaml:"data,omitempty"` // base64, only if embedded
Path string `yaml:"path,omitempty"` // relative/absolute path
URL string `yaml:"url,omitempty"` // remote URL
}
Wallpaper contains wallpaper image data or references.
func EncodeWallpaper ¶
EncodeWallpaper encodes image bytes to base64 and returns a Wallpaper struct.
func ExternalWallpaper ¶
ExternalWallpaper creates a Wallpaper struct for an external file reference.