Skip to content

SVG export rejects valid rgba paint with separate presentation opacity #288

Description

@rudycelekli

Current-main reproduction

On d1376371965f513d99cc9ec388835d255c5c88d5, <rect fill="rgba(255,0,0,0.5)" fill-opacity="0.5" .../> renders red at alpha 64/255.

Save this controlled source as rgba-opacity.html:

<!doctype html><html><head></head><body style="margin:0"><svg id="original" width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><title>Screen</title><desc>Controlled color square.</desc><rect fill="rgba(255,0,0,0.5)" fill-opacity="0.5" width="40" height="40"/></svg></body></html>

Run the packaged public helper:

python3 skills/diagram-design/scripts/export_svg.py rgba-opacity.html rgba-opacity.svg

It returns 2 with duplicate attribute because normalization adds a second fill-opacity. No SVG is written.

Expected behavior

references/export.md describes SVG export as carrying diagram CSS, prefixing defs IDs and rewriting matching local references, and lossless rgba normalization. A portable export should preserve the diagram's paint semantics.

Native controls

Verified with a browser rendering the owned source HTML and exported SVG, plus Pillow RGBA pixel comparison. A plain red presentation-attribute square still exports identically. The reproduction uses no source scripts, external assets, or network requests.

Proposed narrow scope

Normalize the existing paint/opacity combination without duplicate attributes or changing the browser appearance. Cover both fill and stroke, omission controls, and unrelated text that looks like an attribute.

No examples/templates, manifest versions, new diagram type, source rendering in the extractors, or source execution are involved.

Codex is assisting @rudycelekli with reproduction and implementation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions