Colors baked into SVG

Answered
0
0

I tried making a connection status symbol that changes color.

It did however not seem to update and always stayed red.

At first I thought it would not update but after long searching I chose to use 2 Pictureboxes and hide the other one.

To my surprise this also did not work.

I then figured out that WiseJ seems to bake the color into the SVG completely ignoring the color property.

When using 2 copies of the same SVG it worked.

Changing the fore-color of a picture box should either cause the PictureBox to load a new baked SVG or the color should not be baked into the SVG at all.

 

  • You must to post comments
Best Answer
0
0

Hi Adrian,

the bug was logged as WJ-8130 and is fixed in the latest release (1.3.43)

Best regards
Frank

  • Adrian Joachim
    That fixed it, however it now throws exceptions(invalid argument count) in editor and the sizing of the SVG does not seem to work the same as before.
  • You must to post comments
0
0

Hi Adrian,

This is how it works in Wisej with SVG image and icons:

  • Wisej preloads the svg image and caches it in its original form and checks whether it’s monochrome.
  • When a widget needs to use the svg image, wisej changes all the “fill” colors that are originally set to #000000 to the text color of the widget or the fill color of the icon. It leaves all other colors intact. That’s because typically icons are all set to #000000 in order to create icon fonts (fonts don’t support colored icons).

If you set the ForeColor of  a PictureBox or a Button or any widget with an SVG icon, Wisej will change the #000000 fill of monochrome SVG to match the color. If you don’t explicitly set the color, Wisej uses the theme color in effect for that widget or the general icon color set in the theme.

See this example:

http://demo.wisej.com/svgcolor

I also attached the source. Pick a color from the combo and it changes only for the monochrome sgv. Reset it to empty and it will pick the theme’s color.

HTH

Best,

Luca

Attachment
  • Luca (ITG)
    The color change is done by the client taking advantage of the browser’s built-in svg/xml support. It’s a bug with icon packs. It looks like the color change updates the cached original so at the next change the #000000 is not there anymore (few builds ago wisej was always changing the monochrome color without checking for #000000 – that’s probably why it escaped). If you hit refresh after changing the color you’ll see that it’s changed: when using the icons in the icon pack it works only the first time, then the original is changed. You can also try with the theme icons (i.e. “icon-print”) in which case it always works. I’ll log and it should be fixed with the upcoming update, it’s an easy thing.
  • Luca (ITG)
    Forgot, the base64 is not coming from the server. It’s generated by the client.
  • Luca (ITG)
    And the bug is present only for the ModernUI icons because instead of a global fill color they set the color for each path element, which is where wisej tries not to change to much and checks for #000000. If you try MaterialDesign or FontAwesome icons it works.
  • Adrian Joachim
    Is that going to be fixed?
  • Luca (ITG)
    It will most likely be in the upcoming update tonight.
Showing 2 results
Your Answer

Please first to submit.