OpenCut-app / OpenCut-app/OpenCut

[BUG] Color accuracy: approximate OKLab transform + grayscale light theme charts

Open
#896 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
89.8k
Forks
8.9k
PR merge metrics
No merged PRs in 30d

Description

Bug Report

Platform

All platforms (Linux, macOS, Windows)

Current Behavior

In apps/desktop/src/theme.rs:150-181, the OKLab to sRGB conversion uses approximate hardcoded coefficients that produce visibly incorrect colors:

let red = linear_srgb_to_srgb(4.076_741_7 * l - 3.307_711_6 * m + 0.230_969_94 * s);
let green = linear_srgb_to_srgb(-1.268_438 * l + 2.609_757_4 * m - 0.341_319_4 * s);
let blue = linear_srgb_to_srgb(-0.004_196_086_3 * l - 0.703_418_6 * m + 1.707_614_7 * s);

These are simplified approximations of the OKLab inverse transform. For a video editor, color accuracy is critical - these inaccuracies will compound across the rendering pipeline.

Additionally, light theme chart colors are all grayscale (chroma=0):

chart_1: oklch(0.87, 0.0, 0.0),  // All chart_1 through chart_5 have chroma=0
chart_2: oklch(0.556, 0.0, 0.0),
chart_3: oklch(0.439, 0.0, 0.0),
chart_4: oklch(0.371, 0.0, 0.0),
chart_5: oklch(0.269, 0.0, 0.0),

This makes charts unusable in light mode - all bars/lines render as identical gray.

Expected Behavior
  1. Use the exact OKLab inverse transform matrix from the specification (Björn Ottosson's paper)
  2. Light theme chart colors should have distinct hues (chroma > 0)
Steps To Reproduce
  1. Run desktop app in light mode
  2. Observe chart components - all colors are identical gray
  3. Compare rendered colors against reference OKLab implementation
Recurrence Probability

Always - deterministic color math error

Additional Context

For a video editor, color fidelity is a core requirement. Consider using a vetted color space library like palette or oklab crate instead of hand-rolled approximations. The current implementation deviates from the OKLab spec.

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

Start in apps/desktop/src/theme.rs:150-181 and compare the OKLab-to-sRGB conversion with Björn Ottosson's specification or a vetted OKLab implementation. Inspect the light-theme chart_1 through chart_5 definitions as well. Done means the conversion matches the reference and light-theme chart colors have distinct hues with chroma greater than zero.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.