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

Define variable in puml files to reference color #54

Closed
bschwarz opened this issue Jan 30, 2023 · 6 comments
Closed

Define variable in puml files to reference color #54

bschwarz opened this issue Jan 30, 2023 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@bschwarz
Copy link

Define a variable for each puml file that defines the color for that resource based on the category color. This way the color for the resource can be referenced directly instead of looking up the color manually. For example, using this value in sequence diagrams activate bars.

I believe there is just a small changed needed in icon.py, in the generate_puml() method:

puml_content += f"!define AWS_COLOR_{target} {color}\n\n"

which will produce, for example: !define AWS_COLOR_Lambda #D86613

or perhaps for capitalized:
puml_content += f"!define AWS_COLOR_{target.upper()} {color}\n\n"

which will produce, for example: !define AWS_COLOR_LAMBDA #D86613

@gadams999
Copy link
Contributor

Hi @bschwarz,

Thanks for the suggestion which I can see help reduce the complexity of coloring the icons in PUML diagrams. Depending upon the next release of the AWS Icon set we may incorporate into that sprint.

@gadams999 gadams999 added the enhancement New feature or request label Jan 30, 2023
@hakanson
Copy link
Contributor

I do have colors defined in AWSCommon.puml using the color name with a comment for the categories it applies to.

' Customer Enablement; Database; Developer Tools; Satellite
!define AWS_COLOR_BLUE #3A47CB
' Cloud Financial Management; Internet of Things; Storage
!define AWS_COLOR_GREEN #3F8624
' Blockchain; Compute; Containers; Media Services; Quantum Technologies
!define AWS_COLOR_ORANGE #D86613
' Application Integration; Management & Governance; VR & AR
!define AWS_COLOR_PINK #CD2264
' Analytics; Game Tech; Networking & Content Delivery; Serverless
!define AWS_COLOR_PURPLE #693BC5
' Business Applications; Contact Center; Front-End Web & Mobile; Robotics; Security, Identity & Compliance
!define AWS_COLOR_RED #D6232C
' End User Computing; Machine Learning; Migration & Transfer
!define AWS_COLOR_TURQUOISE #1B7B67

Example of usage from examples /S3 Upload Workflow.puml

' define custom group for Amazon S3 bucket
AWSGroupColoring(S3BucketGroup, #FFFFFF, AWS_COLOR_GREEN, plain)
!define S3BucketGroup(g_alias, g_label="Amazon S3 bucket") AWSGroupEntity(g_alias, g_label, AWS_COLOR_GREEN, SimpleStorageService, S3BucketGroup)

and multiple examples in https://github.com/awslabs/aws-icons-for-plantuml/tree/main/examples/architecture-blog

Do you think using AWS_COLOR_LAMBDA would be a better experience over AWS_COLOR_ORANGE ? Maybe these need to be documented better on home page or on AWSSymbols.md

@bschwarz
Copy link
Author

Yes, I do believe AWS_COLOR_LAMBDA would be better. If I am composing a sequence diagram, and I want to make the activation bar the color of the resource, currently (and this is what I do now), I have to lookup that resource to find the category it belongs to, and then find the color. Lambda is easy because I just know it is orange. But some of the other resources not so obvious. I think the bang for the buck is worth it, since it's such a small change.

Another option would be to have some sort of puml lookup function, so you could do get_color("lambda"), but this might be a little harder to implement...although might be better from a user experience.

@hakanson
Copy link
Contributor

Do you think per service and resource colors would be too many, vs using the categories from AWSSymbols.md like AWS_COLOR_COMPUTE or AWS_COLOR_INTERNETOFTHINGS - e.g.. do we want to go as deep as AWS_COLR_IoTThingTemperatureHumiditySensor ?

The !include files are organized per category so that is likely easier to figure out that the associated color.

@hakanson
Copy link
Contributor

hakanson commented Feb 1, 2023

To better document the color definitions, I'm thinking of adding this table this into AWSSymbols.md

PUML Macro (Name) Color Categories
AWS_COLOR #232F3E
AWS_BG_COLOR #FFFFFF
AWS_BORDER_COLOR #FF9900
AWS_COLOR_BLUE #3A47CB Customer Enablement; Database; Developer Tools; Satellite
AWS_COLOR_GREEN #3F8624 Cloud Financial Management; Internet of Things; Storage
AWS_COLOR_ORANGE #D86613 Blockchain; Compute; Containers; Media Services; Quantum Technologies
AWS_COLOR_PINK #CD2264 Application Integration; Management & Governance; VR & AR
AWS_COLOR_PURPLE #693BC5 Analytics; Game Tech; Networking & Content Delivery; Serverless
AWS_COLOR_RED #D6232C Business Applications; Contact Center; Front-End Web & Mobile; Robotics; Security, Identity & Compliance
AWS_COLOR_TURQUOISE #1B7B67 End User Computing; Machine Learning; Migration & Transfer

@bschwarz
Copy link
Author

bschwarz commented Feb 1, 2023

Yes, that would be good to have. I also would almost like to see the reverse table, where the first column is either the category or resource, because when I am looking up a color for reference, I am usually looking to see which color corresponds to a particular resource. At least that is 90% of my use cases.

hakanson added a commit that referenced this issue Feb 2, 2023
Update to Release 15 (2023.01.31) of AWS Architecture Icons and address issues #54 and #55.

Full formatted **Release Notes** below.

---

To reference files specific to this release, define `AWSPuml` to:

`!define AWSPuml https://raw.githubusercontent.com/awslabs/aws-icons-for-plantuml/v15.0/dist`

This release recreates the icons based on the 2023-01-31 (15-2023.01.31) updated AWS Architecture Icons.

## Updates

- Updated to Release 15 (2023.01.31) of [AWS Architecture Icons](https://aws.amazon.com/architecture/icons/)
  - New icons in the `Analytics`, `ApplicationIntegration`, `BusinessApplications`, `Compute`, `Containers`, `Database`, `DeveloperTools`, `EndUserComputing`, `InternetOfThings`, `MachineLearning`, `ManagementGovernance`, `MigrationTransfer`, `NetworkingContentDelivery`, `SecurityIdentityCompliance`, and `Storage` categories.
- Document color definitions on `AWSSymbols.md` ([issue 54](#54))
- Enhance `AWSSimplified.puml` to support sequence diagrams ([issue 55](#55))
- Updated to use latest PlantUML version (1.2023.1)
- Updated to use latest Apache Batik version (1.16)
- Experimental support for numbered callouts using SVG sprites in `AWSExperimental.puml`

## Breaking Changes

- In the `Compute` category:
  - `EC2R5dInstance` and `EC2RdnInstance` were removed
- In the `Containers` category:
  - `RedHatOpenShift` was replaced by `RedHatOpenShiftServiceonAWS`
- In the `Database` category:
  - `QuantumLedgerDatabase2` was removed
- In the `EndUserComputing` category:
  - `WorkSpaces` was replaced by `WorkSpacesFamilyAmazonWorkSpaces`
  - `WorkSpacesWeb` was replaced by `WorkSpacesFamilyAmazonWorkSpacesWeb`
- The `GameTech` category was replaced by `Games`
- In the `Storage` category:
  - `CloudEndureDisasterRecovery` was replaced by `ElasticDisasterRecovery`
@hakanson hakanson closed this as completed Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants