Sass adjust-hue()

Beginner
10 min read
Updated: Nov 2026
5 examples
Deprecated

Definition and Usage

Global adjust-hue($color, $degrees) increases or decreases a legacy color’s HSL hue. Example: adjust-hue(#6b717f, 60deg) → #796b7f.

Official Sass docs list it under Deprecated Functions. There is no color.adjust-hue() — migrate to color.adjust($color, $hue: $amount, $space: hsl).

Deprecated.

Because adjust-hue() is redundant with color.adjust(), it is omitted from sass:color. Prefer the module API in new code.

$degrees range.

A number between -360deg and 360deg (inclusive). It may be unitless or use any angle unit (deg, turn, rad, …).

Legacy colors only.

$color must be in a legacy space (rgb, hsl, or hwb). For modern spaces, use color.adjust with an appropriate $space.

Syntax

SCSS
// Deprecated global (legacy code)
adjust-hue(#6b717f, 60deg);   // #796b7f
adjust-hue(#d2e1dd, -60deg);  // #d6e1d2
adjust-hue(#036, 45);         // #1a0066

// Prefer today
@use "sass:color";
color.adjust(#6b717f, $hue: 60deg, $space: hsl);

Pattern: recognize adjust-hue in old files → rewrite with color.adjust + $hue (+ $space: hsl on Dart Sass 1.79+).

Migrate to color.adjust

Side-by-side mapping:

LegacyModern
adjust-hue($c, 60deg)color.adjust($c, $hue: 60deg, $space: hsl)
adjust-hue($c, -60deg)color.adjust($c, $hue: -60deg, $space: hsl)
adjust-hue($c, 45)color.adjust($c, $hue: 45deg, $space: hsl)
No color.adjust-hue()Use color.adjust only

SCSS Examples

Examples use the deprecated global where noted, plus a modern color.adjust() migration. Open View Compiled CSS for verified output (matches official Sass docs samples).

Example 1 — Shift Hue +60deg (Official Docs)

Hue 222deg becomes 282deg on a cool grey-blue brand.

SCSS
// Hue 222deg becomes 282deg.
@debug adjust-hue(#6b717f, 60deg); // #796b7f

.swatch {
  --base: #6b717f;
  --plus60: #{adjust-hue(#6b717f, 60deg)};
}

How It Works

  1. Read the color in HSL (hue ≈ 222deg).
  2. Add 60deg to the hue channel.
  3. Emit a new hex #796b7f.
  4. Lightness / saturation character stay related to the original.

Example 2 — Shift Hue −60deg (Official Docs)

Hue 164deg becomes 104deg on a soft mint grey.

SCSS
// Hue 164deg becomes 104deg.
@debug adjust-hue(#d2e1dd, -60deg); // #d6e1d2

.mint {
  color: adjust-hue(#d2e1dd, -60deg);
}

How It Works

  1. Negative $degrees rotates the other way on the wheel.
  2. Hue moves from ~164deg to ~104deg.
  3. Result is the official #d6e1d2.
  4. Useful for cooler / warmer neighbors without inventing hexes.

Example 3 — Unitless Degrees (Official Docs)

Hue 210deg becomes 255deg when you pass 45 without a unit.

SCSS
// Hue 210deg becomes 255deg.
@debug adjust-hue(#036, 45); // #1a0066

.deep {
  background: adjust-hue(#036, 45);
}

How It Works

  1. Unitless numbers are allowed in the −360…360 range.
  2. Prefer deg in new code for clarity.
  3. Deep navy shifts toward purple #1a0066.
  4. Migrate to color.adjust when you edit the file.

Example 4 — Migrate to color.adjust()

Same +60deg and −60deg results using the modern module API.

SCSS
@use "sass:color";

// Prefer on Dart Sass 1.79+:
// color.adjust($c, $hue: 60deg, $space: hsl)

.tokens {
  --plus60: #{color.adjust(#6b717f, $hue: 60deg)};
  --minus60: #{color.adjust(#d2e1dd, $hue: -60deg)};
}

How It Works

  1. Outputs match the official adjust-hue samples.
  2. @use "sass:color" loads the module API.
  3. On Dart Sass 1.79+, add $space: hsl for an explicit space.
  4. No behavior change for these legacy hex inputs.

Example 5 — Build a Mini Hue Palette

Derive warm and cool accents from one brand hex (legacy API for reading old code).

SCSS
$brand: #336699;

.palette {
  --brand: #{$brand};
  --warm: #{adjust-hue($brand, 30deg)};
  --cool: #{adjust-hue($brand, -30deg)};
  --far: #{adjust-hue($brand, 120deg)};
}

How It Works

  1. One seed color yields related accents.
  2. ±30deg makes near neighbors; 120deg jumps farther.
  3. Custom properties store the palette for CSS use.
  4. Rewrite with color.adjust($brand, $hue: 30deg, $space: hsl) in new projects.

Edge Cases & Pitfalls

Most adjust-hue issues are using it in new code, wrong color space, or out-of-range degrees.

deprecated

Do not add adjust-hue to new files

Start with color.adjust(..., $hue: …, $space: hsl). Keep this page for reading and migrating old SCSS.

space

Legacy spaces only

oklch / lab inputs are not for adjust-hue. Convert first or use color.adjust with the right $space.

range

Stay within ±360deg

Official docs require $degrees between -360deg and 360deg inclusive.

module

No color.adjust-hue()

Looking for a module twin will fail. The replacement is always color.adjust.

Sass Support

adjust-hue() remains as a global for compatibility. New work should use sass:color on Dart Sass.

APIStatus
Global adjust-hue()Deprecated — still works on legacy colors
color.adjust(..., $hue: …)Preferred (Dart Sass 1.23+ module)
$space: hslExplicit space on Dart Sass 1.79+
color.adjust-hue()Does not exist

Compile with the Dart Sass CLI.

Key Takeaways

  • Rotates HSL hue on legacy colors by a fixed angle.
  • Deprecated — not in sass:color.
  • Migrate to color.adjust($c, $hue: $d, $space: hsl).
  • $degrees between −360deg and 360deg (unitless OK).

One line: treat adjust-hue as a migration dictionary entry — then live on color.adjust.

Migrate Notes

Practical checklist:

migrate.txt
1. Find adjust-hue($color, $degrees) in legacy SCSS
2. Add @use "sass:color" at the top of the file
3. Replace with color.adjust($color, $hue: $degrees, $space: hsl)
4. Prefer angle units like 60deg over bare 60
5. Retest palette / hover accents visually

Frequently Asked Questions

adjust-hue($color, $degrees) increases or decreases a legacy color’s HSL hue. Example: adjust-hue(#6b717f, 60deg) is #796b7f.
Yes. Official Sass docs list it under Deprecated Functions. It is not part of the sass:color module. Prefer color.adjust($color, $hue: $amount, $space: hsl).
A number between -360deg and 360deg (inclusive). It may be unitless or use any angle unit (deg, turn, rad, and so on).
Because it is redundant with color.adjust(). The new module system intentionally omits adjust-hue(); migrate to color.adjust with $hue and $space: hsl.
No for modern spaces. Official docs require $color to be in a legacy color space (rgb, hsl, or hwb). Convert first, or use color.adjust in a polar space instead.
Replace adjust-hue($color, $amount) with color.adjust($color, $hue: $amount, $space: hsl) after @use "sass:color". On Dart Sass before 1.79, color.adjust($color, $hue: $amount) still shifts hue for legacy colors.

Next: Sass color.alpha()

Read opacity as a 0–1 number from a color.

color.alpha() →

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