How to make code block background a bit darker?

Is there a way to make the background for code blocks darker? It would make them easier for me to read and to see where the blocks begin and end.

I’m an old fart and my vision isn’t what it used to be.

test code block
1 Like

You can use a custom style sheet in your browser for just these pages. Google a bit, I am sure you will find a few options.

Got it! I used Custom CSS by Denis for Chrome. And this works. This one is easier than some of the other tools.

pre code {
background: #c6c7c7 !important;
}
/* I can even prefix it with text and a line feed */
/* .lang-python is for the python language only. */
.lang-python:before {
content: "My custom css:\a" !important;
}

The “!important” is required for this site.

This extension will change the CSS for whole domains. It doesn’t get more specific.

  1. For Chrome here is a search for more extensions: https://chromewebstore.google.com/search/change%20CSS%20website
  2. Brave is also a Chrome-based browser.
1 Like

Related:

Was this changed site-wide recently? The code background seems darker than it used to be, at least in dark mode. I didn’t do anything to make it so.

I think it’s a good change!