Skip to content

Function: generateGradient()

ts
function generateGradient(
   from, 
   to, 
   steps): string[];

Generates an array of steps hex colors interpolated between from and to as a gradient.

Parameters

ParameterType
fromstring
tostring
stepsnumber

Returns

string[]

Example

ts
generateGradient('#000000', '#ffffff', 3) // => ['#000000', '#7f7f7f', '#ffffff']

Since

1.0.0

Released under the MIT License.