The diagram appearance is controlled by a DiagramTheme set on the Theme property. Four themes are included and you can create your own by subclassing DiagramTheme.
Theme Background Nodes Edges Best For DefaultThemeWhite Blue fill, white text Gray Light mode apps DarkThemeDark navy Deep blue fill, red stroke Red Dark mode apps ForestThemeLight green Green fill, white text Green Nature/organic UIs NeutralThemeLight gray Gray fill, dark text Dark gray Minimal/document style
control.Theme = new DarkTheme ();
< diagrams:MermaidDiagramControl
DiagramText = "{Binding MermaidText}" >
< diagrams:MermaidDiagramControl.Theme >
</ diagrams:MermaidDiagramControl.Theme >
</ diagrams:MermaidDiagramControl >
Subclass DiagramTheme and override all abstract members:
using Shiny . Maui . MermaidDiagrams . Theming ;
public sealed class MyCustomTheme : DiagramTheme
public override Color BackgroundColor => Color. FromArgb ( "#fafafa" );
public override Color TextColor => Color. FromArgb ( "#222222" );
public override float FontSize => 13f ;
public override NodeRenderStyle DefaultNodeStyle => new ()
FillColor = Color. FromArgb ( "#6c5ce7" ),
StrokeColor = Color. FromArgb ( "#5a4bd1" ),
TextColor = Colors.White,
public override EdgeRenderStyle DefaultEdgeStyle => new ()
StrokeColor = Color. FromArgb ( "#636e72" ),
LabelBackgroundColor = Color. FromArgb ( "#fafafa" ),
LabelTextColor = Color. FromArgb ( "#222222" )
public override SubgraphRenderStyle DefaultSubgraphStyle => new ()
FillColor = Color. FromArgb ( "#f0f0f5" ),
StrokeColor = Color. FromArgb ( "#6c5ce7" ),
TitleColor = Color. FromArgb ( "#6c5ce7" ),
Property Type Default Description FillColorColor— Background fill color StrokeColorColor— Border stroke color TextColorColor— Label text color StrokeWidthfloat2Border width CornerRadiusfloat4Corner radius for rectangular shapes
Property Type Default Description StrokeColorColor— Line color StrokeWidthfloat2Line width LabelBackgroundColorColor— Background behind edge labels LabelTextColorColor— Edge label text color
Property Type Default Description FillColorColor— Subgraph background fill StrokeColorColor— Subgraph border color TitleColorColor— Subgraph title text color StrokeWidthfloat1.5Border width CornerRadiusfloat8Corner radius of subgraph box
Override GetNodeStyle(int index) to vary node colors by index position:
public override NodeRenderStyle GetNodeStyle ( int index ) =>
FillColor = Colors.SteelBlue,
StrokeColor = Colors.DarkSlateBlue,
FillColor = Colors.MediumSeaGreen,
StrokeColor = Colors.SeaGreen,