Sass color.is-missing() Function

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

What You’ll Learn

color.is-missing() belongs to the built-in sass:color module. It answers: is this named channel missing on the color? This page covers quoted channel names, CSS none, powerless channels after space conversion, how it pairs with color.channel(), the Dart Sass 1.79+ requirement, and five examples.

01

Concept

Missing channels

02

Module

@use "sass:color"

03

Names

Quoted strings

04

Sources

none · powerless

05

Vs

color.channel()

06

Practice

5 examples

What Is color.is-missing()?

Missing means “this dial is not present,” not “this dial reads zero.” Official docs: is-missing returns whether $channel is missing in $color. That matters for modern CSS colors that can use none, and for conversions that leave a channel powerless.

  • color.is-missing(#b37399, "green")false
  • color.is-missing(rgb(100 none 200), "green")true
  • color.is-missing(color.to-space(grey, lch), "hue")true
💡
Beginner tip

Think of a mixer board where one knob was never installed. Reading it as 0 can be misleading. is-missing tells you the knob is absent; channel alone may just report zero.

📝 Syntax

Load the color module, then pass a color and a quoted channel name:

styles.scss
@use "sass:color";

// Dart Sass 1.79+
color.is-missing($color, $channel)

Parameters

ParameterTypeDescription
$colorColorThe color to inspect (required).
$channelQuoted stringChannel name, e.g. "red", "green", "hue", "alpha".

Return value

TypeMeaning
Booleantrue if that channel is missing; otherwise false.

📦 Loading sass:color

There is no separate global is-missing() built-in. Use the module form on Dart Sass 1.79+.

styles.scss
// Recommended — namespaced (Dart Sass 1.79+)
@use "sass:color";
$miss: color.is-missing(rgb(100 none 200), "green");

// Optional — bring members into the current namespace
@use "sass:color" as *;
$miss: is-missing(rgb(100 none 200), "green");

// Optional — custom namespace
@use "sass:color" as c;
$miss: c.is-missing(rgb(100 none 200), "green");
⚠️
Version gate

If Dart Sass reports Undefined function for color.is-missing, upgrade to 1.79+. Older compilers do not include this helper.

🎨 When Is a Channel Missing?

Beginners usually meet missing channels in two situations:

SourceExampleWhat is missing?
CSS none in a color functionrgb(100 none 200)Green channel
Powerless channel after conversioncolor.to-space(grey, lch)Hue (greys have no meaningful hue)
Normal hex / rgb colors#b37399Nothing—is-missing is false

📋 is-missing vs color.channel()

Official channel() docs say missing channels return 0 (possibly with a unit), and point you to is-missing for an explicit check.

HelperReturnsJob
color.is-missing()Boolean“Is this channel absent?”
color.channel()Number“What value does this channel have?” (missing → 0)
styles.scss
@use "sass:color";

$c: rgb(100 none 200);

// true — green is absent
$missing: color.is-missing($c, "green");

// 0 — do not assume green was intentionally zero
$value: color.channel($c, "green");

🛠 Compatibility

This is about Sass compilers, not browsers. The boolean is resolved at compile time—CSS never sees a color.is-missing() call.

FeatureDart SassNotes
color.is-missing()1.79+Part of the modern color-spaces work
color.channel() + missing → 01.79+Pair with is-missing for clarity
Related color.is-powerless()1.79+Sibling check for powerless channels
LibSass / Ruby SassNo modern module color-space API

⚡ Quick Reference

GoalCode
Import color@use "sass:color";
Present channelcolor.is-missing(#b37399, "green")false
CSS nonecolor.is-missing(rgb(100 none 200), "green")true
Powerless huecolor.is-missing(color.to-space(grey, lch), "hue")true
Branch in SCSSif(color.is-missing($c, "hue"), …, …)

Examples Gallery

Examples target Dart Sass 1.79+. Open View Compiled CSS to see the booleans Sass emits.

📚 Getting Started

Official docs samples for present and missing channels.

Example 1 — Normal Hex Has No Missing Channels

A complete RGB hex reports false for green.

styles.scss
@use "sass:color";

@debug color.is-missing(#b37399, "green"); // false

.flags {
  --green-missing: #{color.is-missing(#b37399, "green")};
  --red-missing: #{color.is-missing(#b37399, "red")};
  --blue-missing: #{color.is-missing(#b37399, "blue")};
}

How It Works

Everyday hex colors define all RGB channels, so is-missing returns false for each named channel you check.

Example 2 — CSS none Marks a Channel Missing

Official docs sample with green set to none.

styles.scss
@use "sass:color";

@debug color.is-missing(rgb(100 none 200), "green"); // true

.partial {
  --green: #{color.is-missing(rgb(100 none 200), "green")};
  --red: #{color.is-missing(rgb(100 none 200), "red")};
  --blue: #{color.is-missing(rgb(100 none 200), "blue")};
}

How It Works

none means “no green component,” so green is missing while red and blue remain present.

📈 Practical Patterns

Powerless hues, mixin guards, and pairing with channel().

Example 3 — Grey → LCH Can Lose Hue

Official docs: converting grey into lch leaves hue missing.

styles.scss
@use "sass:color";

$grey-lch: color.to-space(grey, lch);

@debug color.is-missing($grey-lch, "hue"); // true

.neutral {
  --hue-missing: #{color.is-missing($grey-lch, "hue")};
}

How It Works

A pure grey has no chroma, so hue is not meaningful after the conversion. Sass represents that as a missing hue channel.

Example 4 — Guard Before Reading Hue

Skip hue-based logic when the channel is missing.

styles.scss
@use "sass:color";

@mixin hue-label($c) {
  &::after {
    content: if(
      color.is-missing($c, "hue"),
      "no-hue",
      "has-hue"
    );
  }
}

.chip-grey {
  @include hue-label(color.to-space(grey, lch));
}

.chip-pink {
  @include hue-label(color.to-space(#b37399, lch));
}

How It Works

Grey-in-LCH takes the missing branch. A chromatic pink keeps a real hue, so the label becomes has-hue.

Example 5 — Pair is-missing with channel

Show why a zero from channel() is not enough.

styles.scss
@use "sass:color";

$c: rgb(100 none 200);

.report {
  --missing: #{color.is-missing($c, "green")};
  --channel: #{color.channel($c, "green")};
}

How It Works

Green is missing (true), and channel() still reports 0. Without is-missing, you might think green was set to zero on purpose.

🚀 Real-World Use Cases

  • Modern CSS color parsing — handle none safely in design tokens.
  • Space-conversion helpers — detect powerless hue/chroma after to-space.
  • Mixin guards — skip hue rotates when hue is missing.
  • Debugging palettes — log which channels are absent vs zero.
  • color-mix workflows — missing channels can inherit from the other color when mixing.

🧠 How Compilation Works

1

Write SCSS

Call color.is-missing($color, "green") after @use.

Source
2

Resolve the channel

Sass looks up the quoted channel on that color.

Inspect
3

Return a boolean

true if absent, false if present.

Boolean
4

Plain CSS ships

Browsers see true/false or branched results—not a Sass call.

⚠️ Common Pitfalls

  • Old Dart Sasscolor.is-missing needs 1.79+.
  • Unquoted channel names — use "green", not bare green.
  • Trusting channel() == 0 — zero can mean missing; check is-missing.
  • Expecting a color back — this helper returns a boolean.
  • Looking for a global alias — use color.is-missing() from the module.

💡 Best Practices

✅ Do

  • Run Dart Sass 1.79+ before relying on is-missing
  • Quote channel names every time
  • Pair with color.channel() when values and presence both matter
  • Guard hue/chroma logic after converting greys
  • Prefer @use "sass:color"

❌ Don’t

  • Ship CI on older Dart Sass and expect this function to exist
  • Treat every 0 from channel() as intentional
  • Forget that none creates missing channels
  • Rely on LibSass / Ruby Sass
  • Skip checks before hue rotations on near-grey colors

Key Takeaways

Knowledge Unlocked

Five things to remember about color.is-missing()

Boolean channel presence—separate missing from zero, Dart Sass 1.79+.

5
Core concepts
📦 02

Needs

Dart Sass 1.79+

Version
🎨 03

Channel

quoted string

Name
04

Sources

none / powerless

Cause
05

Pair

channel()

Sibling

❓ Frequently Asked Questions

color.is-missing($color, $channel) returns true if that channel is missing on the color. Example: color.is-missing(rgb(100 none 200), "green") is true.
Pass a quoted string such as "green", "hue", or "alpha". Unquoted names are not correct for $channel.
color.is-missing() needs Dart Sass 1.79+. Older compilers report Undefined function.
color.channel() returns a number and uses 0 (sometimes with a unit) when a channel is missing. color.is-missing() returns a boolean so you can tell missing apart from a real zero.
Commonly from CSS none in a color function (rgb(100 none 200)), or when a channel is powerless after converting spaces—for example grey converted to lch can have a missing hue.
No. Use the module form color.is-missing() after @use "sass:color".
Did you know?

Official Sass docs for color.channel() explicitly recommend color.is-missing() when you need to detect missing channels, because a missing channel can look like 0 if you only read the number. That tiny boolean keeps modern CSS none and powerless channels from being misread as intentional zeros.

Conclusion

color.is-missing() is the boolean check for absent color channels. Use it whenever none, powerless hues, or channel() zeros could be ambiguous—on Dart Sass 1.79+.

Continue with color.is-powerless(), color.channel(), or the CSS introduction.

Explore color.is-powerless() Next

Detect powerless hue on greys with the sass:color module (Dart Sass 1.79+).

Sass color.is-powerless() →

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