typst / typst/typst

Oklab colors are not read correctly from SVG images

Open
#3,654 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug svg upstream
Dominant language
Rust
Stars
56.1k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
22

Description

Description

SVGs exported with Typst might use the oklab color space for specifying colors. When opened with image(), these colors are not read correctly.

As an example, this svg code should produce a beige rectangle, however, it is displayed black in a Typst document.

<svg class="typst-doc" viewBox="0 0 49 34" width="49pt" height="34pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml">
    <g>
        <g transform="translate(2 2)">
            <path class="typst-shape" fill="oklab(90.000% 0.16000 0.16000)" d="M 0 0 L 0 30 L 45 30 L 45 0 Z "/>
        </g>
    </g>
</svg>
Typst version
  • I am using the latest version of Typst

Contributor guide

Open the contributing guide

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

Reproduce the issue by opening the provided SVG with Typst's image() function and confirm that the oklab fill renders black instead of beige. Trace the SVG color-reading path from that entry point; done means the supplied oklab color is interpreted correctly and the rectangle renders beige.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.