Skip to content

remotion: Add modern CSS color format support to interpolateColors#6890

Merged
JonnyBurger merged 1 commit intomainfrom
feat/interpolate-colors-modern-formats
Mar 23, 2026
Merged

remotion: Add modern CSS color format support to interpolateColors#6890
JonnyBurger merged 1 commit intomainfrom
feat/interpolate-colors-modern-formats

Conversation

@JonnyBurger
Copy link
Copy Markdown
Member

Summary

  • Add support for oklch(), oklab(), lab(), lch(), and hwb() CSS Color Level 4 formats to interpolateColors()
  • Implement color space conversion functions (OKLab→sRGB, CIE Lab→XYZ→sRGB, HWB→sRGB)
  • Update @remotion/animation-utils color matchers and isColorValue() to recognize new formats
  • Add 18 test cases and documentation

Closes #6847

Test plan

  • All 34 interpolateColors tests pass (including 18 new ones)
  • bun run build succeeds (65/65 tasks)
  • bun run stylecheck passes (210/210 tasks)
  • Verify oklch/oklab/lab/lch/hwb colors render correctly in Remotion Studio
  • Verify zColor() Zod schema accepts new color formats

🤖 Generated with Claude Code

Support oklch(), oklab(), lab(), lch(), and hwb() color formats
in interpolateColors() and related color utilities.

Closes #6847

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Mar 20, 2026 2:27pm
remotion Ready Ready Preview, Comment Mar 20, 2026 2:27pm

Request Review

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Good addition of CSS Color Level 4 support. The color space conversions use standard algorithms (OKLab/Björn Ottosson, CIE Lab/D65, HWB). The implementation is consistent across both packages/core/src/interpolate-colors.ts and packages/animation-utils/src/.../utils.ts.

Two minor issues worth addressing before merge:

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow runpullfrog.com𝕏

expect(result).toBe('rgba(255, 0, 0, 0.502)');
});

test('hwb interpolation', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says "Red to white at midpoint" but the test interpolates from black (hwb(0 0% 0%)) to gray (hwb(0 50% 50%)). The result rgba(255, 128, 128, 1) is correct for black→gray. Either update the comment to describe the actual test case, or clarify if a separate red→white test was intended.

@JonnyBurger JonnyBurger merged commit 142a848 into main Mar 23, 2026
20 checks passed
@JonnyBurger JonnyBurger deleted the feat/interpolate-colors-modern-formats branch March 23, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

interpolateColors: Add support for modern CSS color formats (oklch, oklab, lab, lch)

1 participant