Mermaid node color changes to a different color

Hey I’m using mermaid for a graph, and noticed that the fill color isn’t the color I choosed (second pic is the color supposed to be). here is the code

    graph TB
    
    t[some text]
    
    style t fill:#003503

am i using the wrong css property?

Screenshot 2026-06-10 014948

Hi @gggdotmd ,

No, I don’t think you’re using the wrong CSS property. Mermaid diagrams in Obsidian don’t give you exactly the colors you request, and – more importantly – they render the same code as two different colors between light and dark mode.

The example you posted looks like it was in dark mode. Here’s the same code in light mode:

You can see that in light mode the node is close to – but not exactly – the color you specified.

When in dark mode, Mermaid is doing some kind of transformation that changes dark colors into similar light ones, and vice versa.

I tried to find a code that gives a color similar to the one you’re looking for, and this is what I came up with:

graph TB

    t[some text]
    
    style t fill:#a3e9b1

This is what it looks like in dark mode:

It’s a bit confusing, and I don’t know an easy way to get the colors you want outside of trial and error. But hopefully this will help you eventually get to the colors you want.

Good luck!