Help us shape the future of Go! Take the 2026 Go Developer Survey

gradient

package
v0.17.4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package gradient provides color gradient interpolation shared by the style and fx packages. It lives under internal/ so that fx subpackages can use gradient math without importing the style package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interpolate

func Interpolate(t float64, stops []ColorStop) colorful.Color

Interpolate computes the color at position t (0.0-1.0) along the given gradient stops using CIE-LCh blending for perceptually uniform transitions. Edge cases: empty -> white, single stop -> that color, t outside range -> clamp to nearest stop.

Types

type ColorStop

type ColorStop struct {
	Position float64        // 0.0-1.0
	Color    colorful.Color // from github.com/lucasb-eyer/go-colorful
}

ColorStop defines a color at a specific position along a gradient. Position is in the range 0.0-1.0.

Jump to

Keyboard shortcuts

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