Utilities Reference

This page provides a comprehensive reference of all utilities available in the UnoCSS Easing Gradient preset.

Core Utilities

Easing Functions

Apply easing functions to your gradients:

bg-gradient-fn-{function}
UtilityDescription
bg-gradient-fn-linearLinear gradient (no easing)
bg-gradient-fn-easeDefault easing (cubic-bezier)
bg-gradient-fn-ease-inAcceleration from zero velocity
bg-gradient-fn-ease-outDeceleration to zero velocity
bg-gradient-fn-ease-in-outAcceleration until halfway, then deceleration

Advanced Easing Functions

All these functions have -in, -out, and -in-out variants:

Base FunctionDescription
bg-gradient-fn-sineBased on sine waves
bg-gradient-fn-quadQuadratic curves
bg-gradient-fn-cubicCubic curves
bg-gradient-fn-quartQuartic curves
bg-gradient-fn-quintQuintic curves
bg-gradient-fn-expoExponential curves
bg-gradient-fn-circCircular curves
bg-gradient-fn-backSlight overshoot
bg-gradient-fn-elasticElastic, spring-like effect
bg-gradient-fn-bounceBouncing effect

Example variants:

html
<div class="bg-gradient-fn-sine-in"></div>
<div class="bg-gradient-fn-cubic-out"></div>
<div class="bg-gradient-fn-bounce-in-out"></div>

Custom Steps

Control the precision of your gradients by specifying the number of color stops:

bg-gradient-fn-{function}/{steps}
UtilityDescription
bg-gradient-fn-ease/4Ease gradient with 4 steps (default)
bg-gradient-fn-ease/8Ease gradient with 8 steps
bg-gradient-fn-ease/16Ease gradient with 16 steps

Custom Bezier Curves

Define your own cubic bezier curve:

bg-gradient-fn-bezier-[x1,y1,x2,y2]

Example:

html
<div class="bg-gradient-fn-bezier-[0.25,0.1,0.25,1]"></div>

Gradient Colors

From and To Colors

Set the start and end colors of your gradient:

fn-from-{color}
fn-to-{color}

Examples:

html
<div class="fn-from-blue-500 fn-to-purple-600"></div>
<div class="fn-from-[#ff5500] fn-to-[#ffaa00]"></div>
<div class="fn-from-transparent fn-to-black/50"></div>

Gradient Shapes and Directions

Linear Gradient Directions

fn-to-{direction}
UtilityDescription
fn-to-tTo top
fn-to-trTo top right
fn-to-rTo right
fn-to-brTo bottom right
fn-to-bTo bottom (default)
fn-to-blTo bottom left
fn-to-lTo left
fn-to-tlTo top left

Gradient Shapes

fn-{shape}
UtilityDescription
fn-linearLinear gradient (default)
fn-radialRadial gradient
fn-circleCircular gradient
fn-ellipseElliptical gradient
fn-conicConic gradient

Positioned Gradients

Positioned Circle/Ellipse

fn-circle-at-{position}
fn-ellipse-at-{position}
PositionDescription
centerCenter (default)
topTop center
rightRight center
bottomBottom center
leftLeft center
top-leftTop left corner
top-rightTop right corner
bottom-leftBottom left corner
bottom-rightBottom right corner

Examples:

html
<div class="bg-gradient-fn-ease fn-circle-at-top-left"></div>
<div class="bg-gradient-fn-ease fn-ellipse-at-bottom"></div>

Positioned Conic Gradients

fn-conic-from-{angle}
fn-conic-from-{position}
fn-conic-from-{angle}-at-{position}

Examples:

html
<div class="bg-gradient-fn-ease fn-conic"></div>
<div class="bg-gradient-fn-ease fn-conic-from-45deg"></div>
<div class="bg-gradient-fn-ease fn-conic-from-top-left"></div>
<div class="bg-gradient-fn-ease fn-conic-from-90deg-at-bottom-right"></div>

Color Space Configuration

Control how colors are interpolated:

fn-color-space-{space}
UtilityDescription
fn-color-space-oklchOKLCH color space (default)
fn-color-space-srgbStandard RGB color space
fn-color-space-srgb-linearLinear RGB color space
fn-color-space-display-p3Display P3 color space
fn-color-space-a98-rgbAdobe RGB (1998) color space
fn-color-space-prophoto-rgbProPhoto RGB color space
fn-color-space-rec2020Rec. 2020 color space
fn-color-space-xyzCIE XYZ color space

Usage Examples

Basic Linear Gradient with Easing

html
<div class="bg-gradient-fn-ease fn-from-blue-500 fn-to-purple-600 fn-to-r"></div>

Radial Gradient with Custom Steps

html
<div class="bg-gradient-fn-ease-out/8 fn-from-amber-400 fn-to-orange-600 fn-radial"></div>

Positioned Circle Gradient

html
<div class="bg-gradient-fn-cubic-in fn-from-emerald-400 fn-to-teal-600 fn-circle-at-bottom-right"></div>

Conic Gradient with Custom Position

html
<div class="bg-gradient-fn-sine-in-out fn-from-rose-400 fn-to-pink-600 fn-conic-from-45deg-at-center"></div>

Custom Color Space

html
<div class="bg-gradient-fn-expo fn-from-violet-500 fn-to-indigo-600 fn-to-r fn-color-space-display-p3"></div>

Custom Bezier with Specific Steps

html
<div class="bg-gradient-fn-bezier-[0.34,1.56,0.64,1]/12 fn-from-cyan-400 fn-to-blue-600 fn-to-br"></div>