plot: Index | Files | Directories

package palette

import ""

Package palette provides basic color palette handling.


Package Files

hsva.go palette.go


var HSVAModel = color.ModelFunc(hsvaModel)

HSVAModel converts any color.Color to an HSVA color.

type DivergingPalette Uses

type DivergingPalette interface {

    // CriticalIndex returns the indices of the lightest
    // (median) color or colors in the DivergingPalette.
    // The low and high index values will be equal when
    // there is a single median color.
    CriticalIndex() (low, high int)

DivergingPalette is a collection of colors ordered into a palette with a critical class or break in the middle of the color range.

func Radial Uses

func Radial(colors int, start, end Hue, alpha float64) DivergingPalette

Radial return a diverging palette across the specified range, through white and with the specified alpha.

type HSVA Uses

type HSVA struct {
    H, S, V, A float64

HSVA represents a Hue/Saturation/Value/Alpha color. H, S, V and A are valid within [0, 1].

func (HSVA) RGBA Uses

func (c HSVA) RGBA() (r, g, b, a uint32)

RGBA allows HSVAColor to satisfy the color.Color interface.

type Hue Uses

type Hue float64

Hue represents a hue in HSV color space. Valid Hues are within [0, 1].

const (
    Red Hue = Hue(iota) / 6

func (Hue) Complement Uses

func (h Hue) Complement() Hue

Complement returns the complementary hue of a Hue.

type Palette Uses

type Palette interface {
    Colors() []color.Color

Palette is a collection of colors ordered into a palette.

func Heat Uses

func Heat(colors int, alpha float64) Palette

Heat returns a red to yellow palette with the specified number of colors and alpha.

func Rainbow Uses

func Rainbow(colors int, start, end Hue, sat, val, alpha float64) Palette

Rainbow returns a rainbow palette with the specified number of colors, saturation value and alpha, and hues in the specified range.


brewerPackage brewer provides Brewer Palettes for informative graphics.

Package palette imports 2 packages (graph) and is imported by 2 packages. Updated 2016-08-04. Refresh now. Tools for package owners.