Skip to content

fix(export): retain RGBA alpha with presentation opacity - #321

Open
rudycelekli wants to merge 2 commits into
cathrynlavery:mainfrom
rudycelekli:fix/export-rgba-opacity-20261006
Open

rudycelekli wants to merge 2 commits into
cathrynlavery:mainfrom
rudycelekli:fix/export-rgba-opacity-20261006

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Combine RGBA color alpha with an existing numeric presentation opacity exactly once. Preserve RGBA when CSS or other-element opacity could affect the unresolved cascade, keeping appearance without claiming strict-consumer compatibility in that fallback.

Updates the packaged helper, existing regression verifier/test, affected import/export reference and README together. No manifest version, IR field or diagram type change.

Visual proof

A direct half-alpha/half-opacity red shape exports as alpha64, matching its source. Actual CSS, inline and inherited opacity controls also retain source alpha64 through conservative RGBA preservation; before that fallback they incorrectly exported alpha128.

The proof uses owned neutral source or unchanged shipped assets and actual native producer/browser callers. No diagram, example or template variant is edited; no application integration beyond the named producer/browser is claimed.

Validation gates

  • All 77 commands from .maintainer-policy.json passed on the exact signed head.
  • python3 scripts/test-export-svg-standalone.py passed, including the new regression and existing controls; the regression fails against the original production implementation.
  • Native producer/public CLI evidence passed.
  • Documentation updated with behavior and limits.

Tested head: 9d02c195530360c716c564fdde2eefdda67f227f. Local validation uses macOS, Python 3.12.14, Playwright 1.62.0, Chromium 151.0.7922.34 and Pillow 12.1.1. Hosted matrix checks remain pending. Generated icon outputs passed the existing EOL-insensitive gate, then were restored to their index line endings.

Checklist

  • No manifest version changes or new skin baseline entries.
  • Generated/source artifacts remain consistent.
  • Existing accessible SVG and unchanged shipped variants retain mandatory gates.
  • Code of Conduct respected.

Related issues

Closes #288.

Codex assisted with investigation, implementation and verification on behalf of @rudycelekli. Companion fixes address separate reproduced failures but share helper/verifier/reference sections and may require integration. Existing #282/#284 parsing work, #249 font prose and #66 broad role prose are separate scopes.

Review regressions cover parent fill/stroke inherited independently from child paint, encoded inline declarations and escaped CSS property names. Seven actual source/export browser controls match on the current signed head. This converter does not claim to resolve the full CSS cascade or guarantee strict SVG 1.1 import for unresolved RGBA.

Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com>
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 3/5

[Medium risk] Changes SVG color export logic for opacity handling.

Fix the inherited-opacity and encoded-CSS cases before merging; both can change the exported appearance.

Findings

  1. P1 Children become too transparent ▶
  2. P1 Encoded CSS loses color alpha ▶

Summary

This PR combines RGBA alpha with numeric presentation opacity and preserves RGBA when it detects CSS or another element's opacity.

  • Scopes paint changes to actual attributes and adds regression tests.
  • Updates the README and export reference with the fallback limits.
  • Two appearance problems remain: children inherit changed opacity, and encoded or escaped CSS declarations bypass the fallback.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[RGBA paint attribute] --> B{Matching CSS or another opacity attribute found?}
  B -->|Yes| C[Keep RGBA]
  B -->|No| D{Own numeric opacity?}
  D -->|Yes| E[Multiply alpha and replace opacity]
  D -->|No| F[Add opacity from alpha]
  E --> G[Children inherit the changed opacity]
  F --> H[Missed CSS can override the added opacity]
Loading

Reviews (1) · Last reviewed commit: "fix(export): preserve combined rgba pres..."

Comment thread skills/diagram-design/scripts/export_svg.py
Comment thread skills/diagram-design/scripts/export_svg.py
Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

SVG export rejects valid rgba paint with separate presentation opacity

1 participant