Skip to content

feat: Support for mask-mode#752

Open
hex2f wants to merge 1 commit intovercel:mainfrom
hex2f:main
Open

feat: Support for mask-mode#752
hex2f wants to merge 1 commit intovercel:mainfrom
hex2f:main

Conversation

@hex2f
Copy link
Copy Markdown

@hex2f hex2f commented May 2, 2026

Adds support for the mask-mode property, which controls whether a mask-image is interpreted as an alpha mask or a luminescence mask.

Implementation

  • parseMask reads mask-mode (and the -webkit- prefixed variant) and stores it on the parsed mask, defaulting to match-source.
  • buildMaskImage emits mask-type="alpha" or mask-type="luminance" on the SVG mask element when explicitly set. For match-source no attribute is emitted, falling back to the default (luminance), preserving
    the existing rendering behavior.

Following the existing convention in parseMask (where position, size, repeat, origin, and clip apply as a single value to all layers), maskMode also applies once per element rather than per-layer. This maps cleanly onto SVGs per- mask-type attribute.

Testing

I have added a test which checks that mask-type= is properly applied to the SVG. There should probably be a pixel snapshot test added but I couldn't figure out how to do that, will add if required. All existing tests pass.

@hex2f hex2f requested a review from shuding as a code owner May 2, 2026 23:15
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 2, 2026

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

Project Deployment Actions Updated (UTC)
satori-playground Canceled Canceled Open in v0 May 2, 2026 11:15pm

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.

1 participant