Socket
Socket
Sign inDemoInstall

@microsoft/arbutus.use-prefers-color-scheme

Package Overview
Dependencies
5
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @microsoft/arbutus.use-prefers-color-scheme

usePrefersColorScheme returns a value of prefers-color-scheme media query. Based on Media Queries Level 5: 11.5. Detecting the desire for light or dark color schemes: the prefers-color-scheme feature.


Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

Hook usePrefersColorScheme

usePrefersColorScheme returns a value of prefers-color-scheme media query. Based on Media Queries Level 5: 11.5. Detecting the desire for light or dark color schemes: the prefers-color-scheme feature.

Get Started

npm i @microsoft/arbutus.use-prefers-color-scheme
import { usePrefersColorScheme } from '@microsoft/arbutus.use-prefers-color-scheme';

Usage

const MyComponent = () => {
  const preferredTheme = usePrefersColorScheme(); // "light" | "dark" | undefined
  return <div>{preferredTheme === 'light' ? 'light' : 'dark'</div>;
};

FAQs

Last updated on 29 Nov 2023

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc