How to change color of `inline code block` in css?

Things I have tried

I search internet, this forum and also all .css of minimal theme that I currently use. I didn’t find style name of this code block.

What I’m trying to do

I am trying to change color of text in this block. By default it is red, I want to make it different color.

Thank you in advance

1 Like

Add a CSS snippet with the following CSS. Change the color value according to your requirements

.cm-s-obsidian .HyperMD-codeblock {
    color: yellow;
  }

If this doesn’t work try adding “!important” after the color value.

Edit: @volkovics I am sorry because the above is not for inline code. However, the following is!

.cm-s-obsidian span.cm-inline-code {
    color: yellow;
}
4 Likes

Very good, thank you very much, but there is problem. It works only in “edit mode”, when I open “preview mode” it doesn’t work.

1 Like
.markdown-preview-view code{
         color: yellow;
}

But this will select both inline code as well as code block.

5 Likes

It works fine for me. Thank you for help!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.