theme

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetThemeDescription

func GetThemeDescription(themeName string) string

GetThemeDescription returns the human-readable description for a theme.

Types

type ColorScheme

type ColorScheme struct {
	Text       string `yaml:"text"`
	Background string `yaml:"background"`
	Heading    string `yaml:"heading"`
	Link       string `yaml:"link"`
	CodeBg     string `yaml:"code_bg"`
	CodeText   string `yaml:"code_text"`
	Accent     string `yaml:"accent"`
	Border     string `yaml:"border"`
}

ColorScheme defines the color palette for a theme.

type MarginSettings

type MarginSettings struct {
	Top    float64 `yaml:"top"`
	Bottom float64 `yaml:"bottom"`
	Left   float64 `yaml:"left"`
	Right  float64 `yaml:"right"`
}

MarginSettings defines page margins in millimeters.

type Theme

type Theme struct {
	Name           string         `yaml:"name"`
	PageSize       string         `yaml:"page_size"` // e.g. A4, Letter
	FontFamily     string         `yaml:"font_family"`
	FontSize       int            `yaml:"font_size"` // in pt
	CodeTheme      string         `yaml:"code_theme"`
	LineHeight     float64        `yaml:"line_height"`
	Colors         ColorScheme    `yaml:"colors"`
	Margins        MarginSettings `yaml:"margins"`
	HeaderTemplate string         `yaml:"header_template"`
	FooterTemplate string         `yaml:"footer_template"`
}

Theme defines the document theme styling.

func (*Theme) Clone

func (t *Theme) Clone() *Theme

Clone creates a deep copy of the theme.

func (*Theme) ToCSS

func (t *Theme) ToCSS() string

ToCSS converts theme settings to CSS code.

func (*Theme) Validate

func (t *Theme) Validate() error

Validate checks theme fields for correctness.

type ThemeManager

type ThemeManager struct {
	// contains filtered or unexported fields
}

ThemeManager manages theme loading and retrieval.

func NewThemeManager

func NewThemeManager() *ThemeManager

NewThemeManager creates a new theme manager pre-loaded with built-in themes.

func (*ThemeManager) Get

func (tm *ThemeManager) Get(name string) (*Theme, error)

Get returns the theme with the given name.

func (*ThemeManager) List

func (tm *ThemeManager) List() []string

List returns the names of all available themes in sorted order.

func (*ThemeManager) LoadFromFile

func (tm *ThemeManager) LoadFromFile(path string) (*Theme, error)

LoadFromFile loads a theme from a YAML file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL