palettize

package
v0.0.0-...-3926965 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: MIT Imports: 5 Imported by: 0

README

🎨 palettize

a simple & dependency-free golang lib to get the perceptually nearest palette color given an arbitrary color and a palette (:

TODO

  • Add usage example
  • go mod init

References

Color diff function based on this article about Colour metric by Thiadmer Riemersma, CompuPhase.


Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidColorHexString = errors.New("invalid color hex string")

Functions

This section is empty.

Types

type Color

type Color color.RGBA

func ColorFromHex

func ColorFromHex(hc string) (Color, error)

func (Color) Distance

func (c Color) Distance(c2 Color) float64

func (Color) Hex

func (c Color) Hex() string

func (Color) IsGray

func (c Color) IsGray() bool

type Palette

type Palette []Color

func (Palette) Convert

func (p Palette) Convert(c Color) Color

func (Palette) Index

func (p Palette) Index(c Color) int

Jump to

Keyboard shortcuts

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