question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Don't enable DarkMode on Certain Divs

See original GitHub issue

Hello, first of all thanks for making it open source, it’s really handy and easy to use and also it really makes UI look great.

I use the library in my website, I was wondering if there’s a feature to not apply darkMode in certain elements. Like if there’s a css tag --darkmode-donot-apply or something like that just don’t convert colors for that element.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
OverVladcommented, Jan 15, 2021

@Gusted Thank you for the help! I forgot to add the * symbol after the selector. with .flag-icon * all works correctly

1reaction
Gustedcommented, Jan 14, 2021

Hey @OverVlad!

We have 2 options to ignore styling. I see you mention SVG so I assume it has inline styles

<line style="This is an inline style" />

You can add an selector to the IgnoreInlineStyle option via the api. The selector should match the elements directly that has the inline style e.g. if you have

<svg class="flag-icon" some-nonsense-attributes>
    <line style="" />
    etc.
</svg>

An selector like

.flag-icon *

should be added.

Whereby the enable API should look like

enable({}, {url: ['*'], ignoreInlineStyle: ['.flag-icon *'], css: '', ignoreImageAnalysis: null, invert: []});

The only intresting part is url has to be * and ignoreInlineStyle that contains all the CSS Selectors that should be ignored for inline styling.

If you have any other questions, don’t hesitate to ask them.

Regards, Gusted

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set dark mode for random HTML?
Yes it is possible set the dark mode for any random content as well. ... concept and by gives you a widget to...
Read more >
Disable or IGNORE only single div/element · Issue #4144
I'd like to be able to disable dark reader on a certain div. I use the monaco-editor which is embedded in an iframe...
Read more >
Create A Dark/Light Mode Switch with CSS Variables
Step by step guide on how to create a dark-light mode switch with CSS ... <div class="slider round"></div> </label> <em>Enable Dark Mode!
Read more >
Light & Dark mode WITHOUT CSS! - YouTube
The color-scheme property is a super useful property. It allows us to switch the UI elements, like form controls, scrollbars, and all that ......
Read more >
How to Enable Dark Mode in HTML Email
The dark text on dark background issue will happen with email clients that do support dark mode but don't support prefers-color-scheme . That...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found