Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

useColorScheme() provides access to the devices color scheme.

License

NotificationsYou must be signed in to change notification settings

uiwjs/react-use-colorscheme

Repository files navigation

Build & DeployCoverage StatusNPM Versionreact@^18

useColorScheme() is a tiny, zero-dependency, SSR hook for responding to devices color scheme changes.

Quick Start

npm install @uiw/react-use-colorscheme

Using

importReactfrom"react";import{useColorScheme}from'@uiw/react-use-colorscheme';exportdefaultfunctionApp(){constcolorScheme=useColorScheme();return(<div><h1style={{margin:0}}>useColorScheme</h1><div>{colorScheme==='dark' ?'🌒 dark' :'🌞 light'}</div><p>Test by setting light and dark themes in your OS</p><imgstyle={{maxWidth:520}}src="https://github.com/uiwjs/react-use-online/assets/1680273/38090578-258c-496d-afdb-0493677e12f9"/></div>);}

Related

  • useOnlineuseOnline is a tiny, zero-dependency hook for responding to online/offline changes.

Contributors

As always, thanks to our amazing contributors!

Made withcontributors.

License

Licensed under the MIT License.

About

useColorScheme() provides access to the devices color scheme.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    [8]ページ先頭

    ©2009-2025 Movatter.jp