DiagramTheme Class

The colors and the font of a diagram: the variables of the themes of Mermaid. DiagramTheme.Default, DiagramTheme.Dark, DiagramTheme.Forest, DiagramTheme.Neutral and DiagramTheme.Base are the themes of Mermaid 12; change a value with with: DiagramTheme.Default with { NodeBackground = "#e0f2fe" }.

public sealed class DiagramTheme : IEquatable<DiagramTheme>
Implements

Constructors

NameDescription
DiagramTheme()

DiagramTheme()

DiagramTheme.cs
public DiagramTheme()

No documentation is available.

Properties

NameDescription
AlternateBackgroundGets an alternate fill, such as the regions of a concurrent state (Mermaid altBackground).
ArrowheadColorGets the color of the arrowheads (Mermaid arrowheadColor).
BackgroundGets the background of the diagram, or null for a transparent background (Mermaid background).
BaseGets the base theme of Mermaid, the starting point of custom themes.
ClusterBackgroundGets the fill of the clusters, such as the subgraphs of a flowchart (Mermaid clusterBkg).
ClusterBorderColorGets the outline of the clusters (Mermaid clusterBorder).
CompositeBackgroundGets the fill of the composite states (Mermaid compositeBackground).
CompositeTitleBackgroundGets the fill of the title bar of the composite states (Mermaid compositeTitleBackground).
DarkGets the dark theme of Mermaid.
DefaultGets the default theme of Mermaid: lavender nodes and yellow clusters.
EdgeLabelBackgroundGets the background of the labels of the edges (Mermaid edgeLabelBackground).
FontFamilyGets the CSS font-family of the texts, or null for the family of the text measurer.
FontSizeGets the size of the texts, in pixels. The default is 16, the size of Mermaid.
ForestGets the forest theme of Mermaid: shades of green.
InnerEndBackgroundGets the inner circle of the end states (Mermaid innerEndBackground).
IsDarkGets a value that indicates whether the theme has light texts on dark colors.
LineColorGets the color of the lines of the edges (Mermaid lineColor).
NeutralGets the neutral theme of Mermaid: shades of gray, for printing.
NodeBackgroundGets the fill of the nodes (Mermaid mainBkg).
NodeBorderColorGets the outline of the nodes (Mermaid nodeBorder).
NodeTextColorGets the color of the labels of the nodes (Mermaid nodeTextColor, or textColor).
NoteBackgroundGets the fill of the notes (Mermaid noteBkgColor).
NoteBorderColorGets the outline of the notes (Mermaid noteBorderColor).
NoteTextColorGets the color of the texts of the notes (Mermaid noteTextColor).
PaletteGets the colors of the categories, such as the sections of a mindmap or the groups of an architecture diagram (Mermaid cScale0 to cScale11).
PrimaryBorderColorGets the color of the outlines drawn on DiagramTheme.PrimaryColor (Mermaid primaryBorderColor).
PrimaryColorGets the main color, the base of the others (Mermaid primaryColor).
PrimaryTextColorGets the color of the texts drawn on DiagramTheme.PrimaryColor (Mermaid primaryTextColor).
RowEvenBackgroundGets the fill of the even rows of a table (Mermaid rowEven).
RowOddBackgroundGets the fill of the odd rows of a table, such as the attributes of an entity (Mermaid rowOdd).
SecondaryBorderColorGets the color of the outlines drawn on DiagramTheme.SecondaryColor (Mermaid secondaryBorderColor).
SecondaryColorGets the second color, for the elements that must stand out from the main ones (Mermaid secondaryColor).
SecondaryTextColorGets the color of the texts drawn on DiagramTheme.SecondaryColor (Mermaid secondaryTextColor).
SpecialStateColorGets the fill of the start and end states (Mermaid specialStateColor).
StrokeWidthGets the width of the outlines of the shapes. The default is 1.
TertiaryBorderColorGets the color of the outlines drawn on DiagramTheme.TertiaryColor (Mermaid tertiaryBorderColor).
TertiaryColorGets the third color (Mermaid tertiaryColor).
TertiaryTextColorGets the color of the texts drawn on DiagramTheme.TertiaryColor (Mermaid tertiaryTextColor).
TextColorGets the color of the texts drawn on the background, such as the labels of the edges (Mermaid textColor).
TitleColorGets the color of the titles of the diagram and of the clusters (Mermaid titleColor).
TitleFontSizeGets the size of the title of the diagram, in pixels. The default is 18.

AlternateBackground

DiagramTheme.cs

Gets an alternate fill, such as the regions of a concurrent state (Mermaid altBackground).

public SceneColor AlternateBackground { get; init; }

Property value

SceneColor

ArrowheadColor

DiagramTheme.cs

Gets the color of the arrowheads (Mermaid arrowheadColor).

public SceneColor ArrowheadColor { get; init; }

Property value

SceneColor

Background

DiagramTheme.cs

Gets the background of the diagram, or null for a transparent background (Mermaid background).

public SceneColor? Background { get; init; }

Property value

SceneColor?

Gets the base theme of Mermaid, the starting point of custom themes.

public static DiagramTheme Base { get; }

Property value

DiagramTheme

ClusterBackground

DiagramTheme.cs

Gets the fill of the clusters, such as the subgraphs of a flowchart (Mermaid clusterBkg).

public SceneColor ClusterBackground { get; init; }

Property value

SceneColor

ClusterBorderColor

DiagramTheme.cs

Gets the outline of the clusters (Mermaid clusterBorder).

public SceneColor ClusterBorderColor { get; init; }

Property value

SceneColor

CompositeBackground

DiagramTheme.cs

Gets the fill of the composite states (Mermaid compositeBackground).

public SceneColor CompositeBackground { get; init; }

Property value

SceneColor

CompositeTitleBackground

DiagramTheme.cs

Gets the fill of the title bar of the composite states (Mermaid compositeTitleBackground).

public SceneColor CompositeTitleBackground { get; init; }

Property value

SceneColor

Gets the dark theme of Mermaid.

public static DiagramTheme Dark { get; }

Property value

DiagramTheme

Gets the default theme of Mermaid: lavender nodes and yellow clusters.

public static DiagramTheme Default { get; }

Property value

DiagramTheme

EdgeLabelBackground

DiagramTheme.cs

Gets the background of the labels of the edges (Mermaid edgeLabelBackground).

public SceneColor EdgeLabelBackground { get; init; }

Property value

SceneColor

FontFamily

DiagramTheme.cs

Gets the CSS font-family of the texts, or null for the family of the text measurer.

public string? FontFamily { get; init; }

Property value

string?

Remarks

When the text measurer has fonts (ITextMeasurer.Fonts), the texts are measured and drawn with the first family of the list the fonts have. Otherwise the texts are laid out with the metrics of the measurer: a family with other widths can overflow the shapes.

Gets the size of the texts, in pixels. The default is 16, the size of Mermaid.

public double FontSize { get; init; }

Property value

double

Gets the forest theme of Mermaid: shades of green.

public static DiagramTheme Forest { get; }

Property value

DiagramTheme

InnerEndBackground

DiagramTheme.cs

Gets the inner circle of the end states (Mermaid innerEndBackground).

public SceneColor InnerEndBackground { get; init; }

Property value

SceneColor

Gets a value that indicates whether the theme has light texts on dark colors.

public bool IsDark { get; init; }

Property value

bool

Gets the color of the lines of the edges (Mermaid lineColor).

public SceneColor LineColor { get; init; }

Property value

SceneColor

Gets the neutral theme of Mermaid: shades of gray, for printing.

public static DiagramTheme Neutral { get; }

Property value

DiagramTheme

NodeBackground

DiagramTheme.cs

Gets the fill of the nodes (Mermaid mainBkg).

public SceneColor NodeBackground { get; init; }

Property value

SceneColor

NodeBorderColor

DiagramTheme.cs

Gets the outline of the nodes (Mermaid nodeBorder).

public SceneColor NodeBorderColor { get; init; }

Property value

SceneColor

NodeTextColor

DiagramTheme.cs

Gets the color of the labels of the nodes (Mermaid nodeTextColor, or textColor).

public SceneColor NodeTextColor { get; init; }

Property value

SceneColor

NoteBackground

DiagramTheme.cs

Gets the fill of the notes (Mermaid noteBkgColor).

public SceneColor NoteBackground { get; init; }

Property value

SceneColor

NoteBorderColor

DiagramTheme.cs

Gets the outline of the notes (Mermaid noteBorderColor).

public SceneColor NoteBorderColor { get; init; }

Property value

SceneColor

NoteTextColor

DiagramTheme.cs

Gets the color of the texts of the notes (Mermaid noteTextColor).

public SceneColor NoteTextColor { get; init; }

Property value

SceneColor

Gets the colors of the categories, such as the sections of a mindmap or the groups of an architecture diagram (Mermaid cScale0 to cScale11).

public IReadOnlyList<SceneColor> Palette { get; init; }

PrimaryBorderColor

DiagramTheme.cs

Gets the color of the outlines drawn on DiagramTheme.PrimaryColor (Mermaid primaryBorderColor).

public SceneColor PrimaryBorderColor { get; init; }

Property value

SceneColor

PrimaryColor

DiagramTheme.cs

Gets the main color, the base of the others (Mermaid primaryColor).

public SceneColor PrimaryColor { get; init; }

Property value

SceneColor

PrimaryTextColor

DiagramTheme.cs

Gets the color of the texts drawn on DiagramTheme.PrimaryColor (Mermaid primaryTextColor).

public SceneColor PrimaryTextColor { get; init; }

Property value

SceneColor

RowEvenBackground

DiagramTheme.cs

Gets the fill of the even rows of a table (Mermaid rowEven).

public SceneColor RowEvenBackground { get; init; }

Property value

SceneColor

RowOddBackground

DiagramTheme.cs

Gets the fill of the odd rows of a table, such as the attributes of an entity (Mermaid rowOdd).

public SceneColor RowOddBackground { get; init; }

Property value

SceneColor

SecondaryBorderColor

DiagramTheme.cs

Gets the color of the outlines drawn on DiagramTheme.SecondaryColor (Mermaid secondaryBorderColor).

public SceneColor SecondaryBorderColor { get; init; }

Property value

SceneColor

SecondaryColor

DiagramTheme.cs

Gets the second color, for the elements that must stand out from the main ones (Mermaid secondaryColor).

public SceneColor SecondaryColor { get; init; }

Property value

SceneColor

SecondaryTextColor

DiagramTheme.cs

Gets the color of the texts drawn on DiagramTheme.SecondaryColor (Mermaid secondaryTextColor).

public SceneColor SecondaryTextColor { get; init; }

Property value

SceneColor

SpecialStateColor

DiagramTheme.cs

Gets the fill of the start and end states (Mermaid specialStateColor).

public SceneColor SpecialStateColor { get; init; }

Property value

SceneColor

StrokeWidth

DiagramTheme.cs

Gets the width of the outlines of the shapes. The default is 1.

public double StrokeWidth { get; init; }

Property value

double

TertiaryBorderColor

DiagramTheme.cs

Gets the color of the outlines drawn on DiagramTheme.TertiaryColor (Mermaid tertiaryBorderColor).

public SceneColor TertiaryBorderColor { get; init; }

Property value

SceneColor

TertiaryColor

DiagramTheme.cs

Gets the third color (Mermaid tertiaryColor).

public SceneColor TertiaryColor { get; init; }

Property value

SceneColor

TertiaryTextColor

DiagramTheme.cs

Gets the color of the texts drawn on DiagramTheme.TertiaryColor (Mermaid tertiaryTextColor).

public SceneColor TertiaryTextColor { get; init; }

Property value

SceneColor

Gets the color of the texts drawn on the background, such as the labels of the edges (Mermaid textColor).

public SceneColor TextColor { get; init; }

Property value

SceneColor

TitleColor

DiagramTheme.cs

Gets the color of the titles of the diagram and of the clusters (Mermaid titleColor).

public SceneColor TitleColor { get; init; }

Property value

SceneColor

TitleFontSize

DiagramTheme.cs

Gets the size of the title of the diagram, in pixels. The default is 18.

public double TitleFontSize { get; init; }

Property value

double

Methods

NameDescription
Equals(DiagramTheme?)
Equals(object?)
GetHashCode()
GetPaletteColor(int)Returns the color of a category: the colors of DiagramTheme.Palette repeat.
ToString()

Equals overloads

Equals(DiagramTheme?)

public bool Equals(DiagramTheme? other)
Parameters
other DiagramTheme?
Returns

bool

No documentation is available.

Equals(object?)

public override bool Equals(object? obj)
Parameters
obj object?
Returns

bool

No documentation is available.

GetHashCode()

public override int GetHashCode()

Returns

int

No documentation is available.

GetPaletteColor(int)

DiagramTheme.cs

Returns the color of a category: the colors of DiagramTheme.Palette repeat.

public SceneColor GetPaletteColor(int index)

Parameters

index int
The index of the category.

Returns

SceneColor The color, or DiagramTheme.PrimaryColor when the palette is empty.

ToString()

public override string ToString()

Returns

string

No documentation is available.

Operators

NameDescription
operator ==(DiagramTheme?, DiagramTheme?)
operator !=(DiagramTheme?, DiagramTheme?)

operator ==(DiagramTheme?, DiagramTheme?)

public static bool operator ==(DiagramTheme? left, DiagramTheme? right)

Parameters

left DiagramTheme?
right DiagramTheme?

Returns

bool

No documentation is available.

operator !=(DiagramTheme?, DiagramTheme?)

public static bool operator !=(DiagramTheme? left, DiagramTheme? right)

Parameters

left DiagramTheme?
right DiagramTheme?

Returns

bool

No documentation is available.