Documentation
¶
Index ¶
- func ContrastRatio(color1, color2 string) float64
- func CoolWarmColors(t float64) string
- func DarkCategorical() []string
- func DarkDiverging(accent string) []string
- func DarkSequential(accent string) []string
- func EnsureContrast(fg, bg string, minRatio float64) string
- func HeatmapColors(value float64, darkMode bool) string
- func LightCategorical() []string
- func LightDiverging(accent string) []string
- func LightSequential(accent string) []string
- func PlasmaColors(t float64) string
- func QualitativeColors(index int, darkMode bool) string
- func ViridisColors(t float64) string
- type ChartStyle
- type ColorScheme
- type Theme
- func Default() *Theme
- func Forest(darkMode bool) *Theme
- func FromTokens(tokens *design.DesignTokens) *Theme
- func HighContrast(darkMode bool) *Theme
- func Midnight() *Theme
- func Minimal() *Theme
- func Monochrome(darkMode bool) *Theme
- func New(tokens *design.DesignTokens) *Theme
- func Nord() *Theme
- func Ocean(darkMode bool) *Theme
- func Paper() *Theme
- func Scientific() *Theme
- func Sunset(darkMode bool) *Theme
- func Wrapped() *Theme
- func (t *Theme) AxisStyle() svg.Style
- func (t *Theme) BodyStyle() svg.Style
- func (t *Theme) GetColor(index int) string
- func (t *Theme) GetDivergingColor(t_value float64) string
- func (t *Theme) GetSequentialColor(t_value float64) string
- func (t *Theme) GridStyle() svg.Style
- func (t *Theme) LabelStyle() svg.Style
- func (t *Theme) TitleStyle() svg.Style
- type Typography
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContrastRatio ¶
ContrastRatio calculates the WCAG contrast ratio between two colors
func CoolWarmColors ¶
CoolWarmColors returns colors from a cool-warm diverging palette (-1 to 1)
func DarkCategorical ¶
func DarkCategorical() []string
DarkCategorical returns a categorical color palette for dark mode
func DarkDiverging ¶
DarkDiverging returns a diverging color palette for dark mode
func DarkSequential ¶
DarkSequential returns a sequential color palette for dark mode
func EnsureContrast ¶
EnsureContrast adjusts a foreground color to ensure sufficient contrast with background
func HeatmapColors ¶
HeatmapColors returns colors for a heatmap based on value (0-1)
func LightCategorical ¶
func LightCategorical() []string
LightCategorical returns a categorical color palette for light mode
func LightDiverging ¶
LightDiverging returns a diverging color palette for light mode
func LightSequential ¶
LightSequential returns a sequential color palette for light mode
func PlasmaColors ¶
PlasmaColors returns colors from the Plasma palette (0-1) Plasma is another perceptually uniform color map
func QualitativeColors ¶
QualitativeColors returns high-contrast colors for categorical data
func ViridisColors ¶
ViridisColors returns colors from the Viridis palette (0-1) Viridis is a perceptually uniform color map
Types ¶
type ChartStyle ¶
type ChartStyle struct {
// Stroke widths
GridStrokeWidth float64
AxisStrokeWidth float64
DataStrokeWidth float64
// Opacities
GridOpacity float64
FillOpacity float64
// Marker sizes
PointSize float64
MarkerSize float64
// Spacing
Padding float64
MarginTop float64
MarginRight float64
MarginBottom float64
MarginLeft float64
// Border radius for bars, boxes, etc.
BarRadius float64
CardRadius float64
}
ChartStyle defines chart-specific styling
type ColorScheme ¶
type ColorScheme struct {
// Sequential palette (for ordered data)
Sequential []string
// Diverging palette (for data with a midpoint)
Diverging []string
// Categorical palette (for distinct categories)
Categorical []string
// Special colors
GridColor string
AxisColor string
TextColor string
BackgroundColor string
BorderColor string
}
ColorScheme defines color palettes for different chart elements
type Theme ¶
type Theme struct {
// Design tokens from design-system package
Tokens *design.DesignTokens
// Color palettes for data visualization
ColorScheme ColorScheme
// Typography settings
Typography Typography
// Chart-specific styling
Chart ChartStyle
}
Theme represents a complete visual theme for dataviz charts
func FromTokens ¶
func FromTokens(tokens *design.DesignTokens) *Theme
FromTokens creates a theme from custom design tokens
func HighContrast ¶
HighContrast returns a high contrast theme for accessibility
func Monochrome ¶
Monochrome returns a monochrome theme (grayscale)
func Scientific ¶
func Scientific() *Theme
Scientific returns a theme suitable for scientific publications
func (*Theme) GetDivergingColor ¶
GetDivergingColor returns a color from the diverging palette (-1.0 to 1.0)
func (*Theme) GetSequentialColor ¶
GetSequentialColor returns a color from the sequential palette (0.0 to 1.0)
func (*Theme) LabelStyle ¶
LabelStyle returns SVG style for axis labels
func (*Theme) TitleStyle ¶
TitleStyle returns SVG style for chart titles
type Typography ¶
type Typography struct {
// Font families
TitleFont string
BodyFont string
MonoFont string
// Font sizes
TitleSize units.Length
SubtitleSize units.Length
BodySize units.Length
CaptionSize units.Length
LabelSize units.Length
// Font weights
TitleWeight svg.FontWeight
BodyWeight svg.FontWeight
LabelWeight svg.FontWeight
// Line heights (multipliers)
TitleLineHeight float64
BodyLineHeight float64
}
Typography defines font settings for charts