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.

Hey, can you expose `isDark`

See original GitHub issue

Is your feature request related to a problem? Please describe.

Hey, can you expose isDark

For example, I use hasClass to get whether there is a dark class in html or directly from storage, they are not responsive

Describe the solution you’d like

It may be used to adapt to dark mode when paired with some component libraries, thanks

Describe alternatives you’ve considered

No response

Additional context

No response

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
brc-ddcommented, Jul 6, 2022

Try something like this: https://stackblitz.com/edit/vite-1wpj13?file=docs%2Findex.md,docs%2FTellsDark.vue

import { ref, onMounted, onBeforeUnmount } from 'vue';

const isDark = ref(null);
let observer = null;

const setDark = () => {
  isDark.value = document.documentElement.classList.contains('dark');
};

onMounted(() => {
  setDark();
  observer = new MutationObserver(setDark);
  observer.observe(document.documentElement, {
    attributes: true,
    attributeFilter: ['class'],
  });
});

onBeforeUnmount(() => {
  observer.disconnect();
});
0reactions
newivescommented, Jul 6, 2022

wow, strong, thanks, this solved my problem❤️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is The Dark Web Illegal? How To Access It Safely? - Clario
Granted, criminals do gravitate towards darknet sites in order to perform unlawful activities. But does that mean that simply accessing the dark web...
Read more >
How to Safely Access the Deep & Dark Webs - Norton
The deep web and the dark web both offer a degree of privacy and anonymity. Dark web websites are often associated with illegal...
Read more >
Live View is not working or is dark - Support
The solution is to go to your camera's settings and turn off exposure simulation and that will give you a properly exposed live...
Read more >
How to Get on the Dark Web: A Step-by-Step Guide
Stil wondering about how to get on the dark web? Our guide has you covered. We have everything from privacy tips to site...
Read more >
video is dark in slow motion - OnePlus Community
hi there,please let me know if there is something to do in slow motion mode, ... The slower the motion, the more light...
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