Interpolate color channels exactly at a fixed t value.

Example

Interpolate color channels exactly at a fixed t value.

highlighted = computed this step

Step 1 — Endpoint colors

Set up the exact input values.

color lerp((0, 0, 255), (255, 0, 0), 1/3)\begin{array}{c|c}\text{color lerp}&\text{((0, 0, 255), (255, 0, 0), 1/3)}\end{array}

Step 2 — Red channel

Compute the highlighted value.

red85\begin{array}{c|c}\text{red}&\hlmath{\text{85}}\end{array}

Step 3 — Green channel

Compute the highlighted value.

green0\begin{array}{c|c}\text{green}&\hlmath{\text{0}}\end{array}

Step 4 — Blue channel

Compute the highlighted value.

blue170\begin{array}{c|c}\text{blue}&\hlmath{\text{170}}\end{array}

Step 5 — Hex color

State the final color.

hex color#5500AA\begin{array}{c|c}\text{hex color}&\hlmath{\text{\#5500AA}}\end{array}
linear-interpolate-color Color interpolation applies the same lerp formula to red, green, and blue channels independently.