Sass color.adjust()

Beginner
12 min read
Updated: Nov 2026
5 examples
Compiled CSS

Definition and Usage

color.adjust() increases or decreases one or more channels of a color by fixed amounts and returns a new color. Load it with @use "sass:color". The global alias is adjust-color().

By default it adjusts channels in the color’s own space. Pass $space to adjust in another space (Dart Sass 1.79+). The result always stays in the original color’s space.

Official idea.

Add the keyword values to each channel. Example: color.adjust(#6b717f, $red: 15) → #7a717f.

Prefer over lighten / darken.

Legacy lighten() / darken() map to color.adjust(..., $lightness: …, $space: hsl). Prefer the module helper in new code.

Do not mix channel families.

For legacy colors, do not adjust RGB and HSL (or HWB) channels in the same call. Pass $space explicitly when you can.

Syntax

SCSS
@use "sass:color";

// RGB
color.adjust(#6b717f, $red: 15);

// HSL (fixed amounts)
color.adjust($brand, $lightness: 10%);
color.adjust($brand, $lightness: -10%);
color.adjust($brand, $hue: 45deg, $space: hsl);

// Alpha
color.adjust($brand, $alpha: -0.2);

// Modern spaces (Dart Sass 1.79+)
color.adjust(lab(40% 30 40), $lightness: 10%, $a: -20);

Pattern: @use "sass:color" → pick channel keywords → add/subtract fixed amounts → use the returned color in CSS.

vs scale / change

Three related sass:color writers:

FunctionWhat it doesUse when
color.adjust()Adds / subtracts fixed amountsExact steps: +15 red, +10% lightness
color.scale()Scales toward min/max by %Relative “a bit lighter / more transparent”
color.change()Sets absolute channel valuesForce hue=120 or alpha=0.5 exactly

Legacy migrations (official docs):

Old globalModern equivalent
lighten($c, $a)color.adjust($c, $lightness: $a, $space: hsl)
darken($c, $a)color.adjust($c, $lightness: -$a, $space: hsl)
saturate($c, $a)color.adjust($c, $saturation: $a, $space: hsl)
adjust-hue($c, $d)color.adjust($c, $hue: $d, $space: hsl)
transparentize($c, $a)color.adjust($c, $alpha: -$a) (or prefer scale)

SCSS Examples

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

Example 1 — Adjust an RGB Channel

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

SCSS
@use "sass:color";

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

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

How It Works

  1. Start from #6b717f.
  2. Add 15 to the red channel only.
  3. Green and blue stay the same.
  4. Result is #7a717f.

Example 2 — Lighten and Darken with Lightness

Fixed percentage shifts replace old lighten / darken calls.

SCSS
@use "sass:color";

$brand: #336699;

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

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

How It Works

  1. Hex converts into HSL under the hood.
  2. +10% lightness lightens the brand color.
  3. -10% lightness darkens it by the same step.
  4. Same idea as classic lighten / darken, with an explicit module call.

Example 3 — Soften with Alpha

Negative alpha makes a color more transparent.

SCSS
@use "sass:color";

$brand: #336699;

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

How It Works

  1. Start fully opaque (alpha 1).
  2. $alpha: -0.2 yields 80% opacity.
  3. $alpha: -0.3 yields 70% for the border.
  4. 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.

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

  1. Lightness shifts create darker chip surfaces.
  2. Alpha builds a soft focus / glow ring.
  3. Hue rotation invents a related accent.
  4. One brand token drives several UI states.

Example 5 — Module vs Global adjust-color()

Both names perform the same fixed-channel adjust.

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

  1. Module and global RGB adjusts match.
  2. Prefer color.adjust() so the source module is obvious.
  3. Saturation -20% mutes a warm accent.
  4. Interpolation writes the colors into custom properties.

Edge Cases & Pitfalls

Most color.adjust bugs are mixed channel families, wrong helper, or missing @use.

channels

Do not mix RGB with HSL/HWB

One call may not combine RGB keywords with HSL or HWB keywords on legacy colors. Use one family, or set $space.

scale

Fixed ≠ relative

Want “30% more transparent than it is”? That is usually color.scale(), not a fixed alpha subtract.

clamp

Out-of-range values clamp

RGB, lightness (in lab-like spaces), saturation/chroma lower bounds, and alpha are clamped when the sum leaves the native range.

module

Remember @use "sass:color"

Without the module load, color.adjust is undefined. Global adjust-color() still works but is less clear.

Sass Support

sass:color module loading needs Dart Sass. Prefer it for all new color work.

FeatureStatus
@use "sass:color" / color.adjustDart Sass 1.23+
$whiteness / $blacknessDart Sass 1.28+
$space, $chroma, XYZ, …Dart Sass 1.79+
LibSass / Ruby SassNo module system — use global adjust-color() only if stuck

Compile with the Dart Sass CLI.

Key Takeaways

  • Fixed steps: color.adjust adds or subtracts channel amounts.
  • Load @use "sass:color" and prefer the module name.
  • Replace lighten/darken with lightness adjustments (+ $space: hsl).
  • Relative %? Use scale. Absolute set? Use change.

One line: color.adjust is how modern Sass nudges a color by exact channel steps.

Compile Notes

Conceptual flow:

flow.txt
1. @use "sass:color"
2. Resolve $color into its color space
3. Add each keyword delta to the matching channel
4. Clamp channels that leave their native range
5. Return a new color in the original space for CSS

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, $space: hsl) and darken to a negative lightness adjustment.
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.

Next: Sass color.change()

Set channels to exact values instead of adding deltas.

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.

8 people found this page helpful