scale

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package scale handles color scales and other types of scales

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CEntry

type CEntry struct {
	Value float64
	Color gohue.Color
}

CEntry represents an entry in a color scale

type Color

type Color []CEntry

Color represents an immutable color scale. Entries must be sorted by Value in ascending order.

func (Color) Get

func (c Color) Get(x float64) gohue.Color

Get converts x to a color. The returned color corresponds to the smallest value greater than or equal to x. If there are no such values, Get() returns the last color in this scale.

func (Color) Interpolate

func (c Color) Interpolate(x float64) gohue.Color

Interpolate works like Get except that it interpolates between the colors if x falls between two values in this scale.

Jump to

Keyboard shortcuts

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