blend

package
v0.0.0-...-90d5324 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gradient

func Gradient(a, b color.Color, percentage float32) color.Color

Blend picks a color that's somewhere in between a and b, depending on percentage. 0.0 results in a, 1.0 results in b.

func PickColor

func PickColor(thresholds []Threshold, value uint64) color.Color

PickColor picks a color in based on the given thresholds.

Thresholds are expected to be in decreasing order.

If value is greater than or equal to the greatest Max, the color from that threshold is returned.

If value is less than the Max of the last threshold, the color from that threshold is returned.

Otherwise, the color will be proportionally in between the color of the matching threshold and the next one, based on where value is between the two Max values.

Types

type Threshold

type Threshold struct {
	Max   uint64
	Color color.Color
}

Threshold gives a color to use for values near Max.

Jump to

Keyboard shortcuts

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