linebender / linebender/color

Feature Request: Support for CSS Color Level 5 (`color-mix()` and Relative Color Syntax)

Open
#223 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
110
Forks
14
Avg merge
16h 45m
Merged PRs (30d)
1

Description

Modern browsers have already implemented [CSS Color Module Level 5](https://www.w3.org/TR/css-color-5/).

Would it be possible to support the newly added `color-mix()` and Relative Color Syntax?

## `color-mix()` example

```css
/* Basic: Mixing two colors in srgb space with percentages */
.mix-basic {
background-color: color-mix(in srgb, red 30%, blue 70%);
}

/* Omission: Second percentage is omitted (automatically calculated as 85%) */
.mix-omitted {
background-color: color-mix(in oklab, #007bff 15%, black);
}

/* Hue interpolation method for cylindrical color spaces */
.mix-hue {
background-color: color-mix(in hsl longer hue, hsl(10deg 100% 50%), hsl(150deg 100% 50%));
}
```

## Relative Color Syntax

```css
/* Basic: Destructuring and overriding alpha (opacity) */
.rcs-alpha {
background-color: rgb(from var(--primary) r g b / 0.5);
}

/* Math: Modifying channels using calc() (e.g., creating a lighter variant) */
.rcs-calc {
background-color: hsl(from #007bff h s calc(l + 20%));
}

/* Channel keyword swapping (e.g., using 'r' channel value for 'g' and 'b') */
.rcs-swap {
color: rgb(from oklch(0.6 0.25 120) r r r);
}
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by locating the CSS color parsing and serialization entry points, then compare the issue's color-mix() and Relative Color Syntax examples with current support. Done means both syntax families, including omitted percentages, hue interpolation, channel references, and calc() expressions, are supported and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, rust
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.