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
Concept
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.
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.
Foundation
📝 Syntax
Load the color module, then call the function with keyword channel arguments:
Add to RGB channels (typically unitless 0–255 scale for legacy RGB).
$hue
Angle
Rotate hue (for example 30deg or -20deg).
$saturation / $lightness
Percentage
Shift HSL saturation or lightness by a fixed %.
$whiteness / $blackness
Percentage
HWB channels (Dart Sass 1.28+).
$alpha
Number
Change opacity (for example -0.2 for more transparent).
$space
Color space name
Adjust in another space (Dart Sass 1.79+), e.g. hsl, oklch.
Return value
Type
Meaning
Color
A new color in the same space as $color, with the requested channel shifts applied (some channels clamp when they leave their native range).
Modules
📦 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+).
Rules
🎨 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.
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.
Support
🛠 Compatibility
This is about Sass compilers, not browsers. Compiled CSS receives a finished color—no color.adjust() call remains.
Feature
Dart Sass
Notes
@use "sass:color" / color.adjust
1.23+
Preferred module API
$whiteness / $blackness
1.28+
HWB adjustments
$space, $chroma, $x/$y/$z
1.79+
Modern spaces (oklch, lab, …)
LibSass / Ruby Sass
No module API
May expose global adjust-color(); prefer Dart Sass
Cheat Sheet
⚡ Quick Reference
Goal
Code
Import color
@use "sass:color";
More red
color.adjust($c, $red: 15)
Lighten (fixed %)
color.adjust($c, $lightness: 10%)
Darken (fixed %)
color.adjust($c, $lightness: -10%)
Desaturate
color.adjust($c, $saturation: -20%)
More transparent
color.adjust($c, $alpha: -0.2)
Rotate hue
color.adjust($c, $hue: 30deg)
Legacy global
adjust-color($c, $red: 15)
Compare
📋 adjust vs scale vs change
Official docs point to these three siblings for different jobs.
Helper
What it does
Mental 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%”
Migrate
📋 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 global
Modern 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)
Hands-On
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).
Module and global RGB adjusts match. Prefer color.adjust() so readers see the helper comes from sass:color.
Applications
🚀 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.
Watch Out
⚠️ Common Pitfalls
Mixing RGB and HSL keywords — causes a compile error; use one family per call.
Expecting relative scaling — adjust 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.
Pro Tips
💡 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
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about color.adjust()
Fixed channel knobs—modern replacement for lighten/darken-style tweaks.
5
Core concepts
📝01
Call
adjust($color, …)
API
📦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.
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.