palette

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package palette provides colours and colour sequences for charts.

The default qualitative sequence is Okabe-Ito, which is designed to remain distinguishable under the common forms of colour vision deficiency. Charts should also encode series redundantly (dash patterns, marker shapes) — colour alone is never sufficient — but starting from a safe palette costs nothing.

Index

Constants

This section is empty.

Variables

View Source
var (
	Blue      = ir.RGB(0x00, 0x72, 0xB2)
	Orange    = ir.RGB(0xE6, 0x9F, 0x00)
	SkyBlue   = ir.RGB(0x56, 0xB4, 0xE9)
	Green     = ir.RGB(0x00, 0x9E, 0x73)
	Yellow    = ir.RGB(0xF0, 0xE4, 0x42)
	Vermilion = ir.RGB(0xD5, 0x5E, 0x00)
	Purple    = ir.RGB(0xCC, 0x79, 0xA7)
	Black     = ir.RGB(0x00, 0x00, 0x00)
	White     = ir.RGB(0xFF, 0xFF, 0xFF)
	Red       = ir.RGB(0xD5, 0x5E, 0x00)
	Gray      = ir.RGB(0x88, 0x88, 0x88)
)

Named colours used by the examples and the default theme.

View Source
var Default = OkabeIto

Default is the palette refract uses when a theme does not override it.

View Source
var OkabeIto = Qualitative{
	Blue,
	Vermilion,
	Green,
	Yellow,
	SkyBlue,
	Orange,
	Purple,
	ir.RGB(0x00, 0x00, 0x00),
}

OkabeIto is the default colourblind-safe qualitative palette.

Okabe & Ito, "Color Universal Design" (2008).

Functions

This section is empty.

Types

type Qualitative

type Qualitative []ir.Color

Qualitative is a sequence of categorical colours.

func (Qualitative) At

func (q Qualitative) At(i int) ir.Color

At returns the i'th colour, wrapping around. A chart with more series than the palette has colours is a chart that needs a different encoding, but wrapping is better than panicking.

Jump to

Keyboard shortcuts

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