base16

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const BlendRatio float64 = 0.55

BlendRatio is the default blend ratio from static color

Variables

Flags are the flags used for generating colors

Functions

func SelectColors

func SelectColors(colors []color.Hct, k int) []color.Hct

SelectColors selects k Hct colors maximizing angular separation

Types

type Base16

type Base16 struct {
	Black, BrightBlack     color.ARGB
	Red, BrightRed         color.ARGB
	Green, BrightGreen     color.ARGB
	Yellow, BrightYellow   color.ARGB
	Blue, BrightBlue       color.ARGB
	Magenta, BrightMagenta color.ARGB
	Cyan, BrightCyan       color.ARGB
	White, BrightWhite     color.ARGB
	// contains filtered or unexported fields
}

Base16 is the generated output

func Generate

func Generate(
	material map[string]color.ARGB,
	quantized []color.ARGB,
) (Base16, error)

Generate generates colors from material color name and quantized colors

func GenerateDynamic

func GenerateDynamic(
	fg, bg color.ARGB,
	colors []color.ARGB,
) Base16

GenerateDynamic generates base16 colors from selecting quantizes color. It takes color with long chroma distance to ensure colors has more variety

func GenerateStatic

func GenerateStatic(primary color.ARGB, src SourceColors) Base16

GenerateStatic generates base16 colors from pre-defined colors

func NewBase16

func NewBase16() Base16

NewBase16 creates a new Base16

func (*Base16) SetBlack

func (b *Base16) SetBlack(c color.Hct)

SetBlack sets the Black and Bright Black color

func (*Base16) SetBlue

func (b *Base16) SetBlue(c color.Hct)

SetBlue sets the Blue and Bright Blue color

func (*Base16) SetCyan

func (b *Base16) SetCyan(c color.Hct)

SetCyan sets the Cyan and Bright Cyan color

func (*Base16) SetGreen

func (b *Base16) SetGreen(c color.Hct)

SetGreen sets the Green and Bright Green color

func (*Base16) SetMagenta

func (b *Base16) SetMagenta(c color.Hct)

SetMagenta sets the Magenta and Bright Magenta color

func (*Base16) SetRed

func (b *Base16) SetRed(c color.Hct)

SetRed sets the Red and Bright Red color

func (*Base16) SetWhite

func (b *Base16) SetWhite(c color.Hct)

SetWhite sets the White and Bright White color

func (*Base16) SetYellow

func (b *Base16) SetYellow(c color.Hct)

SetYellow sets the Yellow and Bright Yellow color

type SourceColors

type SourceColors struct {
	// Black is terminal color 0,8
	Black color.ARGB
	// Red is terminal color 1,9
	Red color.ARGB
	// Green is terminal color 2,A
	Green color.ARGB
	// Yellow is terminal color 3,B
	Yellow color.ARGB
	// Blue is terminal color 4,C
	Blue color.ARGB
	// Magenta is terminal color 5,D
	Magenta color.ARGB
	// Cyan is terminal color 6,E
	Cyan color.ARGB
	// White is terminal color 7,F
	White color.ARGB
}

SourceColors is all source colors for static generation and fallback for dynamic generation

Jump to

Keyboard shortcuts

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