Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the colored version of icons? #33

Closed
Potherca opened this issue Jan 9, 2022 · 3 comments
Closed

How to use the colored version of icons? #33

Potherca opened this issue Jan 9, 2022 · 3 comments
Labels
question Further information is requested

Comments

@Potherca
Copy link
Member

Potherca commented Jan 9, 2022

I take advantage of the last activities on this repo to ask for this question : how to use the colored version of icons ?

Is this now possible ?

This prevents me to use PlantUML as it full potential ...

Originally posted by @ChrisProlls in #20 (comment)

@verschaevesiebe
Copy link

Hi Just an upvote here as i was planning to also use colored icons.
However i'm not able to figure out how to exactly use them in plantuml.

I'm breaking my head on it as it is unclear.
If it is possible to use the Color versions instead of the Mono than can we add examples to the repository readme ?

Thanks for creating the issue.

@Potherca Potherca moved this to Todo in All Projects Jul 3, 2022
@Potherca Potherca moved this from Todo to Backlog in All Projects Jul 3, 2022
@Potherca Potherca added the question Further information is requested label Jul 3, 2022
@Potherca Potherca moved this from Backlog to Todo in All Projects Jul 3, 2022
@travisnielsen
Copy link
Contributor

I don't believe this is currently possible. According to the PlantUML documentation, sprites are monochrome. When invoking PlantUML to create the sprite, it'll be converted to greyscale automatically unless another color is specified. The end result will always be monochrome. This can be confirmed by creating a sprite using a full color icon:

java -Djava.awt.headless=true -jar scripts/plantuml.jar -encodesprite 16z dist/Compute/AzureDisk.png

The resulting sprite is greyscale:

@startuml color-demo

sprite $AzureDisk [70x70/16z] {
xTO73jmm30LH5CEVf07e_hUDe1HbLlOIOdgP0pmNrVQ__vqljRtKEszJh-MP928har8IbHN96RCKcTc3iON8xCOvh9SWOEo6iHo18HiTgw9C8J8YygIePvBf
7d5FNqKUronyLTmzG_nwBOYi2f5HN4ihuZ4LlniV-SN2gBXJYOaWcKV45JqtYSYgnCQi9GB5CsG6X4fu4Q4IleNOGAXu34SPCfLXGEb5qCb_RG21qXtB4VDX
t2iJaeZCI0o43FDX0Pa_0mgPIcsjWdmxu-sXab67slji30k7aqEdxE0_C4s-h1KVcGrWH8YTczKDLaNOKKPO0Iagwjb8Kiey6CPKKMpjlQAdLyaLuxnV4ntf
J9JivWC1oDSAc8r4nQe85LC5eJAg65Is7HaGCDAMiIg0KW8AcPmI121WO253GC1irzRg1giZh4YiLOcrkf1RxTVqlmy
}

Alice -> Bob : Testing <$AzureDisk>

@enduml

image

@Potherca
Copy link
Member Author

Although the sprites themselves are monochrome, there are various ways in which color can be used:

  • Using the color tag: <color:orange><$sprite>
  • Using the sprite's color attribute: <$sprite,color=orange>
  • Setting the background color of the container a sprite is in: rectangle "<$sprite>" #orange

Sadly, using a gradient on the container does not work well with the sprite's background (see example below).

PlantUML Diagram Source
@startuml
!$AzurePuml="https://raw.githubusercontent.com/plantuml-stdlib/Azure-PlantUML/release/2-1/dist"

!include $AzurePuml/AzureCommon.puml
!include $AzurePuml/Storage/AzureDiskStorage.puml

rectangle "default Sprite" as a {
    rectangle "<$AzureDiskStorage>" as a1
}

rectangle "<color:...>" as b {
    rectangle "<color:orange><$AzureDiskStorage>" as b1
    rectangle "<color:blue><$AzureDiskStorage>" as b2
}

rectangle "<$sprite,color=...>" as c {
    rectangle "<$AzureDiskStorage,color=orange>" as c1
    rectangle "<$AzureDiskStorage,color=blue>" as c2
}

rectangle "Container Color" as d {
    rectangle "<$AzureDiskStorage>" as d1 #orange
    rectangle "<$AzureDiskStorage>" as d2 #blue 
}


rectangle "Sprite Color and Container Color" as e {
    rectangle "<$AzureDiskStorage,color=orange>" as e1 #blue
    rectangle "<$AzureDiskStorage,color=blue>" as e2 #orange
}


rectangle "Container Gradient" as f {
    rectangle "<$AzureDiskStorage,color=blue>" as f1 #orange|blue
    rectangle "<$AzureDiskStorage,color=blue>" as f2 #orange|blue
    rectangle "<$AzureDiskStorage,color=blue>" as f3 #orange|blue
    rectangle "<$AzureDiskStorage,color=blue>" as f4 #orange|blue
}

a -[hidden]-> b
b -[hidden]> c
b -[hidden]-> d
d -[hidden]> e
d -[hidden]-> f
@enduml

Repository owner moved this from Todo to Done in All Projects Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Status: Done
Development

No branches or pull requests

3 participants