Sass color.adjust() Function

Beginner
⏱️ 14 min read
📚 Updated: Jul 2026
🎯 5 Examples
sass:color · Dart Sass

What You’ll Learn

color.adjust() belongs to the built-in sass:color module. It nudges a color by fixed channel amounts—more red, less lightness, a bit more transparency—at compile time. This page covers channel keywords, mixing rules, how it replaces old lighten/darken calls, how it differs from scale and change, and five compiled examples.

01

Concept

Fixed channel shifts

02

Module

@use "sass:color"

03

Channels

RGB · HSL · alpha

04

Vs

scale & change

05

Replaces

lighten / darken

06

Practice

5 examples

What Is color.adjust()?

Adjust means “take this color and add or subtract from one or more channels.” Positive values push a channel up; negative values pull it down. Official docs describe it as increasing or decreasing channels by fixed amounts.

  • color.adjust(#6b717f, $red: 15)#7a717f
  • color.adjust(#336699, $lightness: 10%)#4080bf
  • color.adjust(#336699, $alpha: -0.2)rgba(51, 102, 153, 0.8)
💡
Beginner tip

Think of knobs on a mixer: $red: 15 turns the red knob up by 15, $lightness: -10% turns lightness down by 10%. The original color is never mutated—Sass returns a new color.

📝 Syntax

Load the color module, then call the function with keyword channel arguments:

styles.scss
@use "sass:color";

color.adjust($color,
  $red: null, $green: null, $blue: null,
  $hue: null, $saturation: null, $lightness: null,
  $whiteness: null, $blackness: null,
  $alpha: null
  // Dart Sass 1.79+: also $space, $chroma, $x, $y, $z, ...
)

Common parameters

ParameterTypeDescription
$colorColorThe starting color to adjust (required).
$red / $green / $blueNumberAdd to RGB channels (typically unitless 0–255 scale for legacy RGB).
$hueAngleRotate hue (for example 30deg or -20deg).
$saturation / $lightnessPercentageShift HSL saturation or lightness by a fixed %.
$whiteness / $blacknessPercentageHWB channels (Dart Sass 1.28+).
$alphaNumberChange opacity (for example -0.2 for more transparent).
$spaceColor space nameAdjust in another space (Dart Sass 1.79+), e.g. hsl, oklch.

Return value

TypeMeaning
ColorA new color in the same space as $color, with the requested channel shifts applied (some channels clamp when they leave their native range).

📦 Loading sass:color

Prefer the module API. Official docs also document a global name, adjust-color(), for older stylesheets.

styles.scss
// Recommended — namespaced
@use "sass:color";
$c: color.adjust(#6b717f, $red: 15);

// Optional — bring members into the current namespace
@use "sass:color" as *;
$c: adjust(#6b717f, $red: 15);

// Optional — custom namespace
@use "sass:color" as c;
$c: c.adjust(#6b717f, $red: 15);

// Legacy global name
$c: adjust-color(#6b717f, $red: 15);
⚠️
Put @use first

Keep @use "sass:color"; near the top of the file. Built-in modules need Dart Sass (about 1.23+).

🎨 Channel Mixing Rules

Official docs warn that for legacy colors you must not mix RGB keywords with HSL keywords in the same call, or mix those with HWB keywords. Pick one family per call.

OK together?Example
Yes — RGB familycolor.adjust($c, $red: 10, $blue: -5)
Yes — HSL familycolor.adjust($c, $hue: 20deg, $lightness: 5%)
Yes — alpha with eithercolor.adjust($c, $lightness: 5%, $alpha: -0.1)
No — RGB + HSLcolor.adjust($c, $red: 10, $lightness: 5%) → error
💡
Modern tip (Dart Sass 1.79+)

Pass $space explicitly (for example $space: hsl or oklch) when you want to adjust in a chosen color space. Older Dart Sass still supports adjusting HSL channels on hex/RGB colors without $space.

🛠 Compatibility

This is about Sass compilers, not browsers. Compiled CSS receives a finished color—no color.adjust() call remains.

FeatureDart SassNotes
@use "sass:color" / color.adjust1.23+Preferred module API
$whiteness / $blackness1.28+HWB adjustments
$space, $chroma, $x/$y/$z1.79+Modern spaces (oklch, lab, …)
LibSass / Ruby SassNo module APIMay expose global adjust-color(); prefer Dart Sass

⚡ Quick Reference

GoalCode
Import color@use "sass:color";
More redcolor.adjust($c, $red: 15)
Lighten (fixed %)color.adjust($c, $lightness: 10%)
Darken (fixed %)color.adjust($c, $lightness: -10%)
Desaturatecolor.adjust($c, $saturation: -20%)
More transparentcolor.adjust($c, $alpha: -0.2)
Rotate huecolor.adjust($c, $hue: 30deg)
Legacy globaladjust-color($c, $red: 15)

📋 adjust vs scale vs change

Official docs point to these three siblings for different jobs.

HelperWhat it doesMental model
color.adjust()Add/subtract fixed amounts“Plus 10% lightness”
color.scale()Scale toward a bound by a %“Move 20% of the way lighter”
color.change()Set channels to exact values“Make lightness exactly 30%”

📋 Replacing lighten / darken / Friends

Those global helpers are not brought into sass:color as primary APIs. Docs map them to color.adjust when you must preserve behavior.

Old globalModern write
lighten($c, $a)color.adjust($c, $lightness: $a)
darken($c, $a)color.adjust($c, $lightness: -$a)
saturate($c, $a)color.adjust($c, $saturation: $a)
desaturate($c, $a)color.adjust($c, $saturation: -$a)
adjust-hue($c, $a)color.adjust($c, $hue: $a)
transparentize($c, $a)color.adjust($c, $alpha: -$a)

Examples Gallery

Each example uses @use "sass:color". Open View Compiled CSS to see what Dart Sass emits.

📚 Getting Started

Official-style RGB adjust and everyday HSL shifts.

Example 1 — Adjust an RGB Channel

Add a fixed amount to red (official docs example).

styles.scss
@use "sass:color";

@debug color.adjust(#6b717f, $red: 15); // #7a717f

.swatch {
  background: color.adjust(#6b717f, $red: 15);
}

How It Works

The red channel increases by 15. Green and blue stay the same, so #6b717f becomes #7a717f.

Example 2 — Lighten and Darken with Lightness

Fixed percentage shifts replace old lighten / darken calls.

styles.scss
@use "sass:color";

$brand: #336699;

.light {
  color: color.adjust($brand, $lightness: 10%);  // #4080bf
}

.dark {
  color: color.adjust($brand, $lightness: -10%); // #264d73
}

How It Works

Sass converts the hex into HSL, adds or subtracts 10% lightness, then emits a new hex. Same idea as the classic helpers, with an explicit module call.

📈 Practical Patterns

Alpha overlays, theme variants, and the global alias.

Example 3 — Soften with Alpha

Negative alpha makes a color more transparent.

styles.scss
@use "sass:color";

$brand: #336699;

.panel {
  background: color.adjust($brand, $alpha: -0.2); // rgba(..., 0.8)
  border-color: color.adjust($brand, $alpha: -0.3);
}

How It Works

Starting from fully opaque, $alpha: -0.2 yields 80% opacity. Alpha is clamped so it cannot leave the 0–1 range.

Example 4 — Theme Variants from One Brand Color

Build hover, muted, and glow colors from a single token.

styles.scss
@use "sass:color";

$brand: #4caf50;

.chip {
  background: color.adjust($brand, $lightness: -12%);
  color: #fff;
  box-shadow: 0 0 0 4px color.adjust($brand, $alpha: -0.7);
}

.chip:hover {
  background: color.adjust($brand, $lightness: -18%);
  outline-color: color.adjust(#c65353, $hue: -20deg);
}

How It Works

Lightness shifts create darker surfaces; alpha builds a soft ring; hue rotation invents a related accent without picking a second brand hex by hand.

Example 5 — Module vs Global adjust-color()

Both names perform the same fixed-channel adjust.

styles.scss
@use "sass:color";

.names {
  --module: #{color.adjust(#6b717f, $red: 15)};
  --global: #{adjust-color(#6b717f, $red: 15)};
  --muted: #{color.adjust(#c65353, $saturation: -20%)};
}

How It Works

Module and global RGB adjusts match. Prefer color.adjust() so readers see the helper comes from sass:color.

🚀 Real-World Use Cases

  • Hover / active states — darken or lighten a brand color by a fixed step.
  • Muted variants — reduce saturation for secondary text or chips.
  • Overlays — drop alpha for scrims, focus rings, and shadows.
  • Hue families — rotate hue to invent related accents from one token.
  • Migrating legacy SCSS — replace lighten/darken with module calls.
  • Design systems — generate tints and shades without maintaining a huge hex table.

🧠 How Compilation Works

1

Write SCSS

Call color.adjust($color, ...) after @use.

Source
2

Validate channels

Sass checks you did not mix incompatible channel families.

Validate
3

Add fixed amounts

Each keyword is added to its channel; some channels clamp.

Adjust
4

Plain CSS color ships

Browsers receive hex, rgb, or rgba—not a Sass call.

⚠️ Common Pitfalls

  • Mixing RGB and HSL keywords — causes a compile error; use one family per call.
  • Expecting relative scalingadjust is fixed amounts; use color.scale() for proportional moves.
  • Using $space on older Dart Sass — needs 1.79+; HSL adjust on hex still works without it.
  • Assuming no clamping — several channels clamp when pushed out of range (RGB, lightness in lab/oklab, alpha, …).
  • Staying on lighten/darken — prefer color.adjust in new module-based SCSS.

💡 Best Practices

✅ Do

  • Use @use "sass:color" and color.adjust() in new SCSS
  • Keep channel families consistent in one call
  • Prefer Dart Sass; upgrade to 1.79+ for $space / oklch workflows
  • Store brand tokens once, derive hover/muted variants
  • Reach for scale when relative shifts look more natural

❌ Don’t

  • Mix $red with $lightness in the same call
  • Expect the browser to re-run color.adjust
  • Rely on LibSass for sass:color
  • Confuse fixed adjust with absolute change
  • Hand-maintain dozens of hex variants you can derive

Key Takeaways

Knowledge Unlocked

Five things to remember about color.adjust()

Fixed channel knobs—modern replacement for lighten/darken-style tweaks.

5
Core concepts
📦 02

Module

sass:color

@use
🎨 03

Does

fixed amounts

Shift
04

Siblings

scale / change

Family
05

Global

adjust-color()

Alias

❓ Frequently Asked Questions

color.adjust($color, ...) increases or decreases one or more channels by fixed amounts and returns a new color. Example: color.adjust(#6b717f, $red: 15) is #7a717f.
Add @use "sass:color"; then call color.adjust($color, $lightness: 10%) or other channel keywords. Prefer the module form in new SCSS.
adjust adds or subtracts fixed amounts. scale shifts channels fluidly by a percentage of the remaining room. change sets channels to absolute new values.
Yes. Official docs map lighten($color, $amount) to color.adjust($color, $lightness: $amount) and darken to a negative lightness adjustment (optionally with $space: hsl on Dart Sass 1.79+).
The global built-in is adjust-color(...). On sass:color the helper is color.adjust(). Prefer color.adjust() in new code.
Built-in modules with @use need Dart Sass (about 1.23+). $whiteness/$blackness need 1.28+. $space and more modern channels need 1.79+. LibSass and Ruby Sass do not load sass:color the same way.
Did you know?

Official Sass docs recommend passing $space explicitly even for legacy colors once you are on Dart Sass 1.79+, and they map the old lighten, darken, saturate, and desaturate helpers onto color.adjust so module-based stylesheets stay consistent.

Conclusion

color.adjust() is the modern way to nudge colors by fixed channel amounts. Use it for lighten/darken-style steps, alpha overlays, and hue twists; keep channel families consistent; and prefer @use "sass:color" on Dart Sass.

Continue with color.change(), the Sass introduction, or the CSS introduction.

Explore color.change() Next

Set color channels to exact values with the sass:color module.

Sass color.change() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful