Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS: Add bright background to images when using dark theme #309

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,8 @@ html[data-theme='dark'] .docusaurus-highlight-code-line {
.theme-doc-sidebar-menu {
font-size: 14px;
}

/* Hack to make .svg and .png diagrams readable in dark theme */
html[data-theme='dark'] main img {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we'll be adding some transparent themed images: img:not([class^="themedImage"])

(not the most stable element selector but, https://docusaurus.io/docs/markdown-features/assets#themed-images
compiles un-themed images as <img class="img_vXGZ">
and themed images as <img class="themedImage_qLAv themedImage--dark_ONYO"> )

Copy link
Member

@lukaw3d lukaw3d Nov 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh. and :not([src$='#gh-dark-mode-only'])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really - I imagined when #308 is done properly, then each image must either be universal (good to read both on light and dark background) or themed (one image for light, other for dark theme). Your hack would always set the background for universal images when on the dark background even though they should be readable fine?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep yep

background-color: #fff;
}