Color of sprite not working with archimate and sprite from zip file

0 votes
asked Jan 9 in Bug by Serge Wenger Work (10,130 points)

During my test for http://forum.plantuml.net/8798/change-color-of-sprite, I found a bug.

@startuml
sprite Netw jar:archimate/network
!include <tupadr3/font-awesome/star>
class Foo {
 <color:#FF0000><&x></color> someBadField
 <color:red><$star*0.25></color> something else
 <color:#AAAA00><$Netw></color> Not working with archimate and sprite from zip file
 <color:red><$Netw></color> Not working with archimate and sprite from zip file
}
@enduml

http://www.plantuml.com/plantuml/png/fO_1IWGn44Jl-OeM5m-2pg9uMK9OFSnn_w6Pz3ZH93rqEeme_hiJaHtqQXsBgaVLiIYArXHDcIKemObqWHUK0yemXOHANLujbbTp4V8GgoUmMcVqSj-DdFK65ogSg6iaPuQ8fK3F31y6xC2HvN3Pz_jLpbwzETjzUmvQvmbz7oZwSrB8ExjhfElzxTt3xxHE8Jy3nK8R-N5L8-_QxYr-OeMskHMMe1EStm1c3pzVH-44xs66CKJwi-7_l4zpfEnhYby0

1 Answer

0 votes
answered Jan 9 by plantuml (190,670 points)
Images coming from OpenIconic and sprites are monochrome, so change their colors is easy.

The issue is that images coming from "archimate" (and probably sprites from zip files) are PNG. They may contain several colors. So changing their colors is not simple.

Maybe we can detect the special case where the PNG is monochrome and then overide the only color in that case. Would that make sense ?
commented 6 days ago by Serge Wenger Work (10,130 points)
You're right about the colors of the png's. On the other hand, we have put our own png images and a symbol library (monochrome but encoded with a 32bit png) in a zip. I have to turn the png into a sprite and that's it.
commented 6 days ago by plantuml (190,670 points)
Well, after some time, we've found a way to do it easily :-)

So your example is now working with last beta http://beta.plantuml.net/plantuml.jar

The idea is to detect the darker color into the png's file and to replace this only color with the one provided by <color>.
It should work with your own png.
This has not been widely tested, so tell us if you find issues!
commented 5 days ago by Serge Wenger Work (10,130 points)
It is working with archimate. With my own png, there is a problem with alpha channel (only first "black color is used"). I send you per mail the files to reproduce
...