Socket
Book a DemoInstallSign in
Socket

is-darkmode

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-darkmode

A simple utility to find whether darkmode is enabled

0.0.2
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

:waxing_crescent_moon: Is Darkmode?

Downloads this Week Bundle Size Version

Numify

: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:

// 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.

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>
  );
}

:ballot_box_with_check: Example Output

Example Output

:green_heart: Message

I hope you find this useful. If you have any questions, please create an issue.

Keywords

darkmode

FAQs

Package last updated on 01 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.