Skip to main content

Diagram Color Standard (Enhanced)

This document defines the enhanced, systematic color scheme for all Mermaid diagrams in the project. The schema uses a State vs Function separation model to reduce ambiguity and improve accessibility.

Core Principle: State vs Function Separation

Rule: Use fill color for State (data quality), use border/edge color for Function (component/action type)

  • State colors = "What quality/state is this data in?" (Bronze/Silver/Gold/Quarantine)
  • Function colors = "What kind of component/action is this?" (ETL, Infrastructure, CI/CD, etc.)

1. State Tokens (Data Quality/State)

TokenColorHexTextSemantic MeaningUsage
state.bronzeOrange#f57c00#fffRaw, unvalidated, untrusted dataBronze layer nodes
state.bronze.lightLight Orange#ffb74d#111Bronze sub-states (experimental, staging)Bronze variants with dotted border
state.silverGreen#388e3c#fffValidated, quality-assured dataSilver layer nodes
state.silver.lightLight Green#66bb6a#111Silver sub-states (validated+joined, validated+anonymized)Silver variants
state.silver.restrictedGreen#388e3c#fffSilver with PII/sensitive dataSame color + 🔒 icon in label
state.goldBlue#1976d2#fffAuthoritative, business-ready dataGold layer nodes
state.gold.lightLight Blue#64b5f6#111Gold sub-states (experimental views)Gold variants
state.quarantineRed#d32f2f#fffInvalid data, pipeline stops/divertsQuarantine layer nodes

State Semantics Contract:

  • Bronze: Data exists but not validated; pipeline must process before use
  • Silver: Data validated and quality-assured; safe for analytics
  • Gold: Data is authoritative business contract; production-ready for reporting
  • Quarantine: Data is invalid; pipeline stops or diverts; not used downstream

2. Function Tokens (Component/Action Type)

2.1 Processing Functions

TokenColorHexTextSemantic MeaningUsage
func.etlPurple#7b1fa2#fffActive data transformationETL jobs, processing steps
func.etl.lightLight Purple#ba68c8#111ETL sub-operationsTransform, enrich, aggregate
func.infraDark Gray#424242#fffInfrastructure/platform servicesCloudWatch, S3, Glue Catalog, Root nodes
func.infra.lightMedium Gray#616161#fffInfrastructure sub-componentsSub-services, configs

2.2 Control Functions

TokenColorHexTextSemantic MeaningUsage
control.decisionYellow#fbc02d#111Conditional logic, validation gatesDecision diamonds, validation checks
control.testingLight Green#66bb6a#111Quality gates, testsUnit tests, integration tests, smoke tests
control.cicdIndigo#5c6bc0#fffCI/CD automationGitHub Actions, Terraform, deployment

2.3 Flow Functions (Edges/Arrows Only)

TokenColorHexUsageSemantic Meaning
flow.inputLight Blue#64b5f6Edge/arrow colorData input, external source
flow.outputTeal#00897bEdge/arrow colorData output, consumption
flow.ioCyan#00acc1Edge/arrow colorRead/Write operations
flow.processingPurple#7b1fa2Edge/arrow colorActive transformation flow

Rule: Flow tokens are for edges/arrows, NOT node fills. Nodes use state/func tokens.


3. Status Tokens (Operational States)

TokenColorHexTextSemantic MeaningContract
status.successDark Green#2e7d32#fffSuccessful completionOperation completed successfully
status.warningAmber#ffa000#111Attention needed, pipeline continuesPipeline continues, emits alert/metric; data usable with caveats
status.errorRed#d32f2f#fffError, pipeline stops/divertsPipeline stops or diverts; data not used downstream (same as quarantine)

Warning vs Quarantine Contract:

  • Warning (status.warning): Pipeline continues, data is usable but needs attention
  • Quarantine (state.quarantine): Pipeline stops/diverts, data is invalid and not used downstream

4. Special Concept Tokens

TokenColorHexTextSemantic MeaningVisual Indicator
meta.securityDeep Purple#6a1b9a#fffSecurity boundaries, PII handling🔒 icon in label + border
meta.observabilityTeal#00897b#fffMonitoring, logs, metrics, traces〰️ icon in label + border
meta.lineageNeutral Gray#757575#fffVersioning, snapshots, time travel🕐 icon in label + border
meta.markerGray#757575#fffSystem markers, pointers_SUCCESS, _LATEST.json, current/
layout.pathLight Gray#bdbdbd#111Organizational hierarchyPath structure nodes (mortgages/, ingest_date=, run_id=)

5. Accessibility Rules (Deterministic Text Colors)

Rule: Text color is determined by background lightness

Background TypeBackground Hex RangeText ColorExample
Dark#000000 - #808080#ffffffBronze, Silver, Gold, ETL, Infra
Light#808080 - #ffffff#111111Light variants, Yellow, Light Green

Implementation: Always explicitly specify text color in Mermaid:

  • Dark backgrounds: color:#fff
  • Light backgrounds: color:#111

6. Visual Encoding Strategy

Nodes (Entities)

  • Fill: State token (Bronze/Silver/Gold/Quarantine) OR Function token (ETL/Infra)
  • Border: Function token (if fill is state) OR Status token (if applicable)
  • Icon: Special concept indicator (🔒 for security, 〰️ for observability, 🕐 for lineage) - add to label text

Edges (Actions/Flows)

  • Color: Flow token (input/output/io/processing) - use stroke property
  • Style: Solid for normal, dashed for conditional, dotted for metadata

Sub-States

  • Same hue, different lightness: Use .light variant
  • Same color + modifier: Use icon in label or border style (dotted, dashed)

7. Mermaid Implementation Examples

Example 1: State + Function Separation

Example 2: With Icons (in label text)

Example 3: Decision Points

Example 4: CI/CD Pipeline


8. Complete Token Reference

Quick Reference Table

CategoryTokenHexTextMermaid Usage
Statestate.bronze#f57c00#ffffill:#f57c00,color:#fff
Statestate.silver#388e3c#ffffill:#388e3c,color:#fff
Statestate.gold#1976d2#ffffill:#1976d2,color:#fff
Statestate.quarantine#d32f2f#ffffill:#d32f2f,color:#fff
Functionfunc.etl#7b1fa2#ffffill:#7b1fa2,color:#fff
Functionfunc.infra#424242#ffffill:#424242,color:#fff
Controlcontrol.decision#fbc02d#111fill:#fbc02d,color:#111
Controlcontrol.testing#66bb6a#111fill:#66bb6a,color:#111
Controlcontrol.cicd#5c6bc0#ffffill:#5c6bc0,color:#fff
Statusstatus.success#2e7d32#ffffill:#2e7d32,color:#fff
Statusstatus.warning#ffa000#111fill:#ffa000,color:#111
Statusstatus.error#d32f2f#ffffill:#d32f2f,color:#fff
Metameta.security#6a1b9a#ffffill:#6a1b9a,color:#fff or stroke:#6a1b9a
Metameta.observability#00897b#ffffill:#00897b,color:#fff
Metameta.lineage#757575#ffffill:#757575,color:#fff
Metameta.marker#757575#ffffill:#757575,color:#fff
Layoutlayout.path#bdbdbd#111fill:#bdbdbd,color:#111

9. Key Improvements Summary

  1. State vs Function: Clear separation — states for data quality, functions for component types
  2. Blue collisions reduced: Gold = blue; Infrastructure = dark gray; Input/I/O = edges only
  3. Tints/shades: .light variants for sub-states without new hues
  4. Accessibility: Deterministic text colors based on background lightness
  5. Semantic contracts: Clear Warning vs Quarantine definitions
  6. Missing concepts: Security, Observability, Lineage tokens added
  7. Token-based: Reusable design tokens for implementation

10. Migration Checklist

When updating diagrams:

  • Use state tokens for data layers (Bronze/Silver/Gold/Quarantine)
  • Use function tokens for components (ETL, Infrastructure, CI/CD)
  • Apply state+function separation (fill for state, stroke for function where applicable)
  • Use flow tokens only for edges/arrows, not node fills
  • Add icons to labels for special concepts (🔒 security, 〰️ observability, 🕐 lineage)
  • Specify text color explicitly (color:#fff for dark, color:#111 for light)
  • Use control tokens for decision points and testing
  • Use status tokens for operational states (success/warning/error)
  • Test readability in both light and dark themes
© 2026 Stephen AdeiCC BY 4.0