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

change svg background in darkdmode #150

Open
brownsarahm opened this issue Oct 23, 2024 · 2 comments
Open

change svg background in darkdmode #150

brownsarahm opened this issue Oct 23, 2024 · 2 comments

Comments

@brownsarahm
Copy link

Thanks to @ha0ye via carpentries/instructor-training#1715 (comment)

I think adding a light background to svgs for darkmode might be helpful but I am not fully certain if there are downstream effects so making an issue instead of PR

current:

// This section does not correspond to an
// existing light themed sass file - these
// are soley for a dark mode
// Darken any images and desaturate
.img {
filter: brightness(80%) saturate(80%);
}

proposed addition

svg{ 
   background-color: ##cfcfcf;
}

bright white is probably too far, i picked a balanced gray above but actual specific color should be done with contrast in mind...

@astroDimitrios
Copy link
Contributor

I'm happy to try and test this @brownsarahm at the weekend. A more permanent solution is either:

  • Inline the SVGs, this allows them to 'see' the selected theme and change colour based on css inside the inlined svg.
  • Provide an alternate SVG (or png etc) and wrap our images in picture tags. I have a feeling I tried this and couldn't get it to work but I will have another look.

Useful Links:

@astroDimitrios
Copy link
Contributor

It turns out picture tags will respect a users theme preference but not the bootstrap chosen theme! I haven't tested inline SVGs but I think they will run into the same problem.

I have opened #153, which could use some extra testing, to add support for dark mode images :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants