awslabs / aws-icons-for-plantuml

PlantUML sprites, macros, and other includes for Amazon Web Services services and resources
Other
887 stars 149 forks source link

It's always dark mode even no dark mode is specified #69

Closed xianqugithub closed 4 months ago

xianqugithub commented 7 months ago

I am using the following code to generate plantuml

  !define AWSPuml https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v17.0/dist
  !include AWSPuml/AWSCommon.puml
  !include AWSPuml/General/SAMLtoken.puml
  !include AWSPuml/Compute/Lambda.puml
  !include AWSPuml/Analytics/OpenSearchService.puml
  !include AWSPuml/Analytics/OpenSearchServiceOpenSearchDashboards.puml

  Lambda(ingestionLambda, "Ingestion Lambda", "ingest data")

And the resulting image is in dark background. Tried tuning the parameters, but have no luck.

open-search-serverless

hakanson commented 7 months ago

I think I have seen this with older versions of PlantUML. Can you add Title %version() to your file and share the output?

@startuml

Title %version()

!define AWSPuml https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v17.0/dist
!include AWSPuml/AWSCommon.puml
!include AWSPuml/General/SAMLtoken.puml
!include AWSPuml/Compute/Lambda.puml
!include AWSPuml/Analytics/OpenSearchService.puml
!include AWSPuml/Analytics/OpenSearchServiceOpenSearchDashboards.puml

Lambda(ingestionLambda, "Ingestion Lambda", "ingest data")

@enduml

image

xianqugithub commented 7 months ago
Title %version()

!define AWSPuml https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v17.0/dist
!include AWSPuml/AWSCommon.puml
!include AWSPuml/General/SAMLtoken.puml
!include AWSPuml/Compute/Lambda.puml
!include AWSPuml/Analytics/OpenSearchService.puml
!include AWSPuml/Analytics/OpenSearchServiceOpenSearchDashboards.puml

Lambda(ingestionLambda, "Ingestion Lambda", "ingest data")

test

hakanson commented 7 months ago

1.2021.12 is about 2 years old and must not like the Dark Mode support detection logic (included in AWSCommon.puml using the code below). Is this something you can get upgraded?

Can you try and set !$AWS_DARK = false before you !include AWSPuml/AWSCommon.puml and see if that works. Any chance $PUML_MODE being set as plantuml.jar arg?

' Dark Mode support
' ##################################
' if $AWS_DARK is not defined, check $PUML_MODE
!if (%not(%variable_exists("$AWS_DARK")) && (%variable_exists("$PUML_MODE") && $PUML_MODE == "dark"))
!$AWS_DARK = true
!endif
' ensure $AWS_DARK is either true or false
!if %not(%variable_exists("$AWS_DARK") && ($AWS_DARK == true))
!$AWS_DARK = false
!endif
xianqugithub commented 7 months ago

Yes. It's the plantuml.jar file that I used out of date. After changing the jar file, the image is no longer dark theme.

bsem-twlo commented 4 months ago

Was hit with the same issue - out of nowhere all diagrams have black / dark background. Reverted to v15. Specifying these (before include AWSPuml/AWSCommon) didn't help:

!$AWS_DARK = false
!$PUML_MODE = "light"

I think Dark Mode detection logic should be flipped to have bias towards transparent (white) background (maintain compatibility with previous versions).

hakanson commented 4 months ago

The logic is supposed to default to light mode - this is the code inside AWSCommon.puml that would set $AWS_DARK = true

' if $AWS_DARK is not defined, check $PUML_MODE
!if (%not(%variable_exists("$AWS_DARK")) && (%variable_exists("$PUML_MODE") && $PUML_MODE == "dark"))
!$AWS_DARK = true
!endif

I tested with 1.2022.5 and see the same default as dark behavior. I testing the "nested if" logic below and now it works as expect on the older version. Must have been a bug with &&

!if (%not(%variable_exists("$AWS_DARK")))
!if ((%variable_exists("$PUML_MODE") && $PUML_MODE == "dark"))
!$AWS_DARK = true
!endif
!endif

Can you do a local test of the new logic (maybe edit AWSCommon.puml or import a local version) and see if works for you?

hakanson commented 4 months ago

fixed with release 18.0

bsem-twlo commented 4 months ago

Tested v18 - all seems good (light mode as expected)

Thank you for a quick update 😲 👍