https://github.com/mcnaveen/is-darkmode
🦄 A Simple utility to find whether darkmode is enabled.
https://github.com/mcnaveen/is-darkmode
color-scheme darkmode display-theme is-darkmode is-lightmode lightmode
Last synced: 10 months ago
JSON representation
🦄 A Simple utility to find whether darkmode is enabled.
- Host: GitHub
- URL: https://github.com/mcnaveen/is-darkmode
- Owner: mcnaveen
- License: mit
- Created: 2022-08-01T07:39:24.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-01T16:38:28.000Z (almost 4 years ago)
- Last Synced: 2025-05-21T20:11:16.309Z (about 1 year ago)
- Topics: color-scheme, darkmode, display-theme, is-darkmode, is-lightmode, lightmode
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/is-darkmode
- Size: 688 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# :waxing_crescent_moon: Is Darkmode?




:unicorn: A Simple utility to find whether darkmode is enabled.
### :package: Requirements
Node.js 16.x LTS
### :sparkles: Installation
Install the NPM Package with the below command:
```
npm install is-darkmode --save
```
(or)
Install with Yarn:
```
yarn add is-darkmode
```
### :pen: Usage
Import the module in your project:
```javascript
// Commonjs Import
var { isDarkmode } = require("is-darkmode");
// or ES6 import
import { isDarkmode } from "is-darkmode";
```
### :bulb: Example
Inside your React app, Pass the function into a Variable.
With that you can conditionally render the content based on the result of the function.
```jsx
import { isDarkmode } from "is-darkmode";
export default function App() {
const checkDarkmode = isDarkmode();
return (
Hello App
{checkDarkmode ? "Darkmode is Enabled" : "Darkmode is Disabled"}
);
}
```
### :ballot_box_with_check: Example Output

---
#### :green_heart: Message
I hope you find this useful. If you have any questions, please create an issue.