Package Exports
- is-darkmode
- is-darkmode/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-darkmode) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
🌒 Is Darkmode?
🦄 A Simple utility to find whether darkmode is enabled.
📦 Requirements
Node.js 16.x LTS
✨ Installation
Install the NPM Package with the below command:
npm install is-darkmode --save
(or)
Install with Yarn:
yarn add is-darkmode
🖊️ Usage
Import the module in your project:
// Commonjs Import
var { isDarkmode } = require("is-darkmode");
// or ES6 import
import { isDarkmode } from "is-darkmode";
💡 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.
import { isDarkmode } from "is-darkmode";
export default function App() {
const checkDarkmode = isDarkmode();
return (
<div className="App">
<h1>Hello App</h1>
<p>{checkDarkmode ? "Darkmode is Enabled" : "Darkmode is Disabled"}</p>
</div>
);
}
☑️ Example Output
💚 Message
I hope you find this useful. If you have any questions, please create an issue.