Home Sass Color adjust-hue() Sass adjust-hue() Definition
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
Syntax // 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+).
Code
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).
1. +60deg 2. −60deg 3. Unitless 4. Migrate 5. Palette Example 1 — Shift Hue +60deg (Official Docs) Hue 222deg becomes 282deg on a cool grey-blue brand.
// Hue 222deg becomes 282deg.
@debug adjust-hue(#6b717f, 60deg); // #796b7f
.swatch {
--base: #6b717f;
--plus60: #{adjust-hue(#6b717f, 60deg)};
} .swatch {
--base: #6b717f;
--plus60: #796b7f;
} How It Works Read the color in HSL (hue ≈ 222deg).Add 60deg to the hue channel.Emit a new hex #796b7f.Lightness / saturation character stay related to the original.Example 2 — Shift Hue −60deg (Official Docs) Hue 164deg becomes 104deg on a soft mint grey.
// Hue 164deg becomes 104deg.
@debug adjust-hue(#d2e1dd, -60deg); // #d6e1d2
.mint {
color: adjust-hue(#d2e1dd, -60deg);
} .mint {
color: #d6e1d2;
} How It Works Negative $degrees rotates the other way on the wheel.Hue moves from ~164deg to ~104deg.Result is the official #d6e1d2.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.
// Hue 210deg becomes 255deg.
@debug adjust-hue(#036, 45); // #1a0066
.deep {
background: adjust-hue(#036, 45);
} .deep {
background: #1a0066;
} How It Works Unitless numbers are allowed in the −360…360 range.Prefer deg in new code for clarity.Deep navy shifts toward purple #1a0066.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.
@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)};
} .tokens {
--plus60: #796b7f;
--minus60: #d6e1d2;
} How It Works Outputs match the official adjust-hue samples.@use "sass:color" loads the module API.On Dart Sass 1.79+ , add $space: hsl for an explicit space.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).
$brand: #336699;
.palette {
--brand: #{$brand};
--warm: #{adjust-hue($brand, 30deg)};
--cool: #{adjust-hue($brand, -30deg)};
--far: #{adjust-hue($brand, 120deg)};
} .palette {
--brand: #336699;
--warm: #333399;
--cool: #339999;
--far: #993366;
} How It Works One seed color yields related accents.±30deg makes near neighbors; 120deg jumps farther.Custom properties store the palette for CSS use.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.
Toolchain
Sass Support adjust-hue() remains as a global for compatibility. New work should use sass:color on Dart Sass.
API Status 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 .
Remember
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
Migrate Notes Practical checklist:
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 What does Sass adjust-hue() do? adjust-hue($color, $degrees) increases or decreases a legacy color’s HSL hue. Example: adjust-hue(#6b717f, 60deg) is #796b7f.
Is adjust-hue() deprecated? 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).
What values can $degrees use? A number between -360deg and 360deg (inclusive). It may be unitless or use any angle unit (deg, turn, rad, and so on).
Why is there no color.adjust-hue()? Because it is redundant with color.adjust(). The new module system intentionally omits adjust-hue(); migrate to color.adjust with $hue and $space: hsl.
Does adjust-hue() work on oklch colors? 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.
How do I migrate old adjust-hue() calls? 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 Developer, cloud engineer, and technical writer
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
Helpful Share Copy link Suggestion