mdBook
mdBook copied to clipboard
Add CSS variable for code block background color
Now the code block background color can be used elsewhere without worrying about the colors getting out of sync.
r? @Dylan-DPC
Thanks for the PR! I'm a bit confused on the motivation here. How can the colors get out of sync? Each theme defines all the colors for highlighting in one file, why would just this one be moved to a variable in another file?
So that it can be used for custom styling, I believe. (Akin to what I am doing here.)
Thanks for the PR! I'm a bit confused on the motivation here. How can the colors get out of sync? Each theme defines all the colors for highlighting in one file, why would just this one be moved to a variable in another file?
It was a while ago, so I don't remember exactly, but I think it was because there might be multiple places in a theme's CSS where you want to use the background color for code blocks. There's a variable for inline-code color, so it's like that, but instead it's for the background color of a code block.
The specific motivation was for #1477, but I should probably close that PR because that approach won't work. See https://github.com/rust-lang/mdBook/pull/1477#issuecomment-796386772 and the comments above it for more about why I opened this PR.
This PR is just a change that might make things a bit easier in the future, but it's possible it wouldn't be that useful. So you can close it if you want :)