Change color of sprite?

0 votes
asked Jan 9 in Question / help by SJrX (120 points)

I was wondering if it was possible to change the color of a sprite inline or in a macro, similar to how the colors look for different access types (e.g., red square for private fields, yellow diamond for protected), but with arbitrary sprites). It seems like it's supported, but I want to use them at certain points, and then declare them in the legend with the color.

Something like the following, or 

@startuml
!include <tupadr3/common>
!include <tupadr3/font-awesome/star>
class Foo {
 <&x{scale=0.25,color=#FF0000}> someBadField
 <$star{scale=0.25,color=#AAAA00} something else }
@enduml

2 Answers

+1 vote
answered Jan 9 by Serge Wenger Work (10,980 points)

A possible solution is:

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

http://www.plantuml.com/plantuml/png/LOx1QW8n54Nt-OfNMheej1agReOGHXTP-W-FvEb4CycGl644yTzDt8XtURddS8V2c7cPWYXpzanm85xXZBd7R4S_8PECjKhv8Zvyj65n18gN6LtUo6EA_8ihbJIHR2OjRC1ImAG4Dm7Aff1o_sbCLwFLzrKh-UmqD6QFpdWAxhNSrRJbLxFzT7__stU2HnzFGA6Gk8k1eglN7m00

0 votes
answered Jan 9 by plantuml (195,460 points)

The current syntax is indeed not very convenient.

With last beta http://beta.plantuml.net/plantuml.jar you can have :

 <&x{scale=2.25,color=#FF0000}> someBadField
 <$star{scale=0.50,color=#FF0000}> other
 <&x*2.25,color=green> someBadField
 <$star*0.50,color=blue> other

Does it sound better this way ?

commented Jan 10 by SJrX (120 points)
Yes thank you very much!
...