Documentation
¶
Overview ¶
Package community imports and converts community color schemes from Windows Terminal JSON format into sidecar theme overrides.
Index ¶
- Variables
- func Blend(c1, c2 string, t float64) string
- func ColorDistance(a, b string) float64
- func ContrastRatio(fg, bg string) float64
- func Convert(scheme *CommunityScheme) styles.ColorPalette
- func Darken(hex string, pct float64) string
- func EnsureContrast(fg, bg string, minRatio float64) string
- func FormatHex(hex string) string
- func FormatSchemeInfo(scheme *CommunityScheme) string
- func HSLToHex(h, s, l float64) string
- func HexToHSL(hex string) (h, s, l float64)
- func HueDegrees(hex string) float64
- func Lighten(hex string, pct float64) string
- func ListSchemes() []string
- func Luminance(hex string) float64
- func PaletteToOverrides(p styles.ColorPalette) map[string]interface{}
- func Saturation(hex string) float64
- func SchemeCount() int
- func WithAlpha(hex, alpha string) string
- type CommunityScheme
Constants ¶
This section is empty.
Variables ¶
var SchemeIndex []string
SchemeIndex is a sorted list of all scheme names.
var SchemeMap map[string]*CommunityScheme
SchemeMap provides O(1) lookup by name.
Functions ¶
func ColorDistance ¶
ColorDistance returns euclidean distance in RGB space (0-441.67).
func ContrastRatio ¶
ContrastRatio returns the WCAG 2.0 contrast ratio between two colors (1 to 21).
func Convert ¶
func Convert(scheme *CommunityScheme) styles.ColorPalette
Convert maps a CommunityScheme to a full Sidecar ColorPalette.
func EnsureContrast ¶
EnsureContrast adjusts fg until the contrast ratio against bg meets minRatio. Blends toward whichever pole (white or black) achieves the target with the smallest shift. Returns the original fg if already sufficient.
func FormatSchemeInfo ¶
func FormatSchemeInfo(scheme *CommunityScheme) string
FormatSchemeInfo returns a brief description for display.
func ListSchemes ¶
func ListSchemes() []string
ListSchemes returns a sorted list of all available scheme names.
func PaletteToOverrides ¶
func PaletteToOverrides(p styles.ColorPalette) map[string]interface{}
PaletteToOverrides serializes a ColorPalette to the override map format for config.json.
func Saturation ¶
Saturation returns the HSL saturation (0-1) of a hex color.
Types ¶
type CommunityScheme ¶
type CommunityScheme struct {
Name string `json:"name"`
Black string `json:"black"`
Red string `json:"red"`
Green string `json:"green"`
Yellow string `json:"yellow"`
Blue string `json:"blue"`
Purple string `json:"purple"`
Cyan string `json:"cyan"`
White string `json:"white"`
BrightBlack string `json:"brightBlack"`
BrightRed string `json:"brightRed"`
BrightGreen string `json:"brightGreen"`
BrightYellow string `json:"brightYellow"`
BrightBlue string `json:"brightBlue"`
BrightPurple string `json:"brightPurple"`
BrightCyan string `json:"brightCyan"`
BrightWhite string `json:"brightWhite"`
Background string `json:"background"`
Foreground string `json:"foreground"`
CursorColor string `json:"cursorColor"`
SelectionBackground string `json:"selectionBackground"`
}
CommunityScheme represents a color scheme in Windows Terminal JSON format.
func GetScheme ¶
func GetScheme(name string) *CommunityScheme
GetScheme returns a scheme by name, or nil if not found.