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

Idea: selector based dark mode support #16

Open
stereobooster opened this issue May 4, 2024 · 5 comments
Open

Idea: selector based dark mode support #16

stereobooster opened this issue May 4, 2024 · 5 comments

Comments

@stereobooster
Copy link

stereobooster commented May 4, 2024

Hey 👋 . It's me again. I know I proposed previous version of dark mode #6. But here is one more twist to it.

In case of selector based dark mode (so people can select in the dropdown: dark, light, auto) picture doesn't work. See withastro/starlight#1829

Maybe we can add option for selector based dark mode. Generated HTML can look like this:

<img id="mermaid-dark-0" class="mermaid-dark"  />
<img id="mermaid-0" class="mermaid-light"  />

And CSS for it can look like this:

html[data-theme="light"] .mermaid-dark {
  display: none;
}

html[data-theme="dark"] .mermaid-light {
  display: none;
}

I know this may be too specific request. Up to your consideration

@remcohaszing
Copy link
Owner

I feel like it would be better to solve this with a new rehype plugin, which changes all responsive <picture> and <video> elements to a class based approach.

@stereobooster
Copy link
Author

Yep, makes sense. 👍

@remcohaszing remcohaszing closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2024
@stereobooster
Copy link
Author

Just realized that this approach would work for inline-svg strategy

@remcohaszing
Copy link
Owner

That’s an interesting point. I’m not really sure how I feel about it.

@remcohaszing remcohaszing reopened this May 6, 2024
@stereobooster
Copy link
Author

Just in case: I do not insist. I see how this can be very specific requirement, which doesn't fit in the project. This was thought out loud

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