termcolor

package module
v0.0.0-...-4c78770 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorLookup = map[string]uint8{}/* 466 elements not displayed */
View Source
var ColorNames = [][]string{}/* 256 elements not displayed */
View Source
var Colors = [256]*ColorProp{}/* 256 elements not displayed */
View Source
var ColorsHex = [256]string{}/* 256 elements not displayed */
View Source
var DefaultGrayMaxDelta uint8 = 20

DefaultGrayMaxDelta is default value for GrayMaxDelta as option for ClosestToRGB func

Functions

func CodeToRGB

func CodeToRGB(n uint8) (uint8, uint8, uint8)

func DistanceRGB

func DistanceRGB(c1 *color.RGBA, c2 *color.RGBA) float64

func ParseHexColor

func ParseHexColor(s string) (c *color.RGBA, err error)

func RGBAToHexColor

func RGBAToHexColor(c color.RGBA) string

func RGBToHexColor

func RGBToHexColor(r uint8, g uint8, b uint8) string

Types

type ClosestToRGBInput

type ClosestToRGBInput struct {
	GrayMaxDelta *uint8 // optional, default: DefaultGrayMaxDelta
	Target       color.RGBA
	RoundMode    RoundMode // optional, default: RoundCloser
}

ClosestToRGBInput is input struct for ClosestToRGB

type ColorProp

type ColorProp struct {
	Hex   string
	Names []string
	HSL   [3]float64
	HSV   [3]float64
	RGBA  color.RGBA
	Code  uint8
}

func ClosestToRGB

func ClosestToRGB(in *ClosestToRGBInput) (*ColorProp, error)

ClosestToRGB finds the closest terminal color to a given full RGB color

func ClosestToRGBFromPalette

func ClosestToRGBFromPalette(target *color.RGBA) *ColorProp

func ClosestToRGBGray

func ClosestToRGBGray(target *color.RGBA, mode RoundMode) *ColorProp

type RoundMode

type RoundMode uint8
const (
	RoundCloser RoundMode = iota
	RoundDown
	RoundUp
)

Jump to

Keyboard shortcuts

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