Socket
Socket
Sign inDemoInstall

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

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

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
5
decreased by-16.67%
Maintainers
2
Weekly downloads
 
Created
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

Package last updated on 09 Nov 2023

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc