gradient

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: MIT Imports: 1 Imported by: 2

README

gradient

A module that provides methods for working with color gradients

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func LinearPoint

func LinearPoint(a, b color.Color, p float64) color.RGBA

LinearPoint takes two colors and a float64, `p`, representing a position between them. It returns the colour represented by position `p` assuming a linear interpolation between the two colors. The position `p` is capped to the range `0 <= p <= 1`.

Example
a := color.RGBA{0xFF, 0x00, 0x00, 0xFF}
b := color.RGBA{0x00, 0x00, 0xFF, 0xFF}

c := LinearPoint(a, b, 0.5)
fmt.Printf("#%02x%02x%02x @ %02x", c.R, c.G, c.B, c.A)
Output:

#80007f @ ff

Types

This section is empty.

Jump to

Keyboard shortcuts

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