question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export to SVG 1.1 includes non-standard rgba colors

See original GitHub issue

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Describe the bug Export to SVG 1.1 includes non-standard rgba colors, when rgb colors would be more appropriate.

In SVG 1.1 colors are expressed as rgb values, while opacity is expressed in a separate attribute. In the candidate SVG 2.0 version, rgba colors are allowed. Usage of rgba color values are non-standard, even though many browsers support it, but browsers are not the only applications that read SVG images.

To Reproduce Steps to reproduce the behavior:

  1. Create a draw.io diagram, containing a rectangle.
  2. Export to SVG
  3. SVG file contains rgba(*, *, *, 1) color elements (* = wildcard).

Expected behavior Minimum: Color values rgba(r, g, b, 1) should be replaced with rgb(r, g, b).

In SVG 1.1, the alpha value should be moved to the attribute *-opacity.

You may want to differentiate between SVG 1.1 and (future) SVG 2.0. In SVG 2.0 the existing behavior is fine (perhaps desired).

draw.io version (In the Help->About menu of the draw.io editor):

  • draw.io version 15.8.6

Desktop (please complete the following information):

  • OS: macOS
  • Browser Safari
  • Version 15.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
aldergcommented, Nov 29, 2021

The next release will use rgb() values.

0reactions
mbrannstromcommented, Nov 25, 2021

Does it work if you change an example to use rgba(#RRGGBBAA) hex notation?

No, it does not work.

The attribute "fill" represents an invalid CSS value ("rgba(#000000ff)").
Original message:
Invalid RGB color: 000000ff.

My current workaround is to run the SVG through sed (BSD syntax here):

sed -E -i~ -e 's/rgba\(([0-9]+) *, *([0-9]+) *, *([0-9]+) *, *1 *\)/rgb(\1, \2, \3)/g' images/*.svg
Read more comments on GitHub >

github_iconTop Results From Across the Web

Color profile - SVG 1.1 (Second Edition)
All SVG colors are specified in the sRGB color space [SRGB]. At a minimum, SVG user agents shall conform to the color behavior...
Read more >
Help:SVG - Wikimedia Commons
SVG images can be animated, but because the SVG is converted to raster PNG format for use in Wikimedia projects, the animation only...
Read more >
How to convert the svg outcome to png? - Super User
I can't give you an exact command, but I know for a fact that it can export SVG to PNG from the GUI,...
Read more >
Inkscape → PDF → includegraphics → XeLaTeX → changed ...
The problem is that Inkscape exports to pdf in RGB colors, no matter what you specified as color. You can check the colors...
Read more >
How can I export an SVG with both RGB and CMYK colors?
As with SVG Full 1.1, SVG Color content may specify color using an ICC ... that the svg file exported by Illustrator doesn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found