Exploring Mermaid Colors: A Markdown Guide

In the realm of data visualization, few tools have gained as much traction as Mermaid. This JavaScript-based diagramming and charting tool allows developers to create complex diagrams using simple text in a Markdown-like language. One of the most captivating aspects of Mermaid is its ability to customize colors, transforming static diagrams into vibrant, engaging visuals. Let's delve into the world of mermaid colors and markdown.

Understanding Mermaid's Color Syntax

Mermaid's color syntax is based on CSS, making it highly versatile and user-friendly. You can use any valid CSS color, including hex, RGB, HSL, and named colors. To apply a color in Mermaid, simply enclose it in square brackets '[]' and place it after the element you want to color. For example, to color a node red, you would write:

graph LR
A[Start] --> B[Is it raining?]
B -->|Yes| C[Take umbrella]
B -->|No| D[Go outside]

In this example, let's color node 'C' red:

Mermaid color palette
Mermaid color palette

graph LR
A[Start] --> B[Is it raining?]
B -->|Yes| C[Take umbrella][red]
B -->|No| D[Go outside]

Coloring Different Mermaid Elements

Nodes and Edges

As demonstrated earlier, you can color nodes and edges in graphs. Here's how you can color an edge:

graph LR
A[Start] -->|[blue]Go| B[End]

Flowcharts and Sequence Diagrams

In flowcharts and sequence diagrams, you can color bands, notes, and other elements. Here's an example of a flowchart with colored bands:

graph TD
A[Start] --> B[Is it raining?]
B -->|Yes| C[Take umbrella][red]
B -->|No| D[Go outside][green]

Color Palettes for Mermaid

Using a consistent color palette can enhance the readability and aesthetics of your diagrams. Here are a few color palettes you might find useful:

Mermaid Treasure Color Palette
Mermaid Treasure Color Palette

  • Coolors - A vibrant palette with five colors.
  • Flatuicolors - A flat design palette with eight colors.
  • Material Palette - A material design palette with a wide range of colors.

Mermaid Color Themes

If you find yourself using the same color palette across multiple diagrams, consider creating a color theme. You can define a theme in your Mermaid configuration or in a separate CSS file. Here's an example of a color theme defined in a CSS file:

/* mermaid-theme.css */
.theme {
  --node-color: #27ae60;
  --edge-color: #2980b9;
  --band-color: #f7941e;
  --note-color: #8e44ad;
}

Then, you can apply this theme to your diagrams:

graph TD
classDef theme fill:#27ae60,stroke:#2980b9,stroke-width:2px;
A[Start] -->|Go| B[End] --> C[End]

Best Practices for Using Mermaid Colors

While Mermaid's color customization is extensive, it's essential to use colors judiciously. Here are some best practices:

Mermade
Mermade

  • Use colors to highlight important information, not to decorate.
  • Keep your color palette consistent across diagrams.
  • Use contrasting colors for better readability.
  • Consider colorblindness when choosing colors. Tools like Coblis can help you simulate your diagrams with colorblindness.

In conclusion, Mermaid's color customization offers a wealth of possibilities for creating engaging and informative diagrams. By understanding Mermaid's color syntax and following best practices, you can unlock the full potential of this powerful data visualization tool.

Floral Mermaid Color Palette
Floral Mermaid Color Palette
Mermaid Procreate Color Palette / ColorsPalettes™
Mermaid Procreate Color Palette / ColorsPalettes™
100 Mermaid Colors
100 Mermaid Colors
Deep Sea Mermaid Color Palette
Deep Sea Mermaid Color Palette
Midnight Mermaid Color Palette
Midnight Mermaid Color Palette
the instructions for how to color coral rainbows with mermaid tails and fish tails on them
the instructions for how to color coral rainbows with mermaid tails and fish tails on them
the color palette is blue, green and purple with text that reads mermaid color palette
the color palette is blue, green and purple with text that reads mermaid color palette
Mermaid core color palette
Mermaid core color palette
purple and teal hues are featured in this collage with mermaid inspired nail polish
purple and teal hues are featured in this collage with mermaid inspired nail polish
Pink Sunset Mermaid Color Palette
Pink Sunset Mermaid Color Palette
Mermaid Birthday Card Color Pallett
Mermaid Birthday Card Color Pallett
Color Palette 095
Color Palette 095
Sleeping Mermaid Color Palette
Sleeping Mermaid Color Palette
Y2K Mermaid Summer
Y2K Mermaid Summer
MagnoliaandMill - Etsy
MagnoliaandMill - Etsy
there are many different sea shells and pearls on the table with text overlaying them
there are many different sea shells and pearls on the table with text overlaying them
🎨 Dive into a world of vibrant hues and dreamy ocean-inspired aesthetics.
🎨 Dive into a world of vibrant hues and dreamy ocean-inspired aesthetics.
Pandora's Reef - Finfolk 2022
Pandora's Reef - Finfolk 2022
Color Palette: Mermaid’s Gold
Color Palette: Mermaid’s Gold
Mermaidcore wedding
Mermaidcore wedding
Mermaid Colour Palette
Mermaid Colour Palette
Mermaid Vibes Procreate Color Palette
Mermaid Vibes Procreate Color Palette
Clementine - Finfolk 2025
Clementine - Finfolk 2025