I haven’t found a way yet, but would really like this feature. There are maybe some properties you can add inside the mermaid diagram code to do this, but i havent looked. Try the mermaid.live website documentation. There is another 3 ear old thread about this:
and this may be in the latest mermaid but not sure if obsidian uses the latest mermaid. This seems rely on using css snippets to add the required css code. I haven’t tried the Dune theme yet either which also does this. I try not to switch themes as it’s a time sink and some themes are difficult to get back out of without editing in the .obsidian directory.