No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 9a142a4 Aug 1, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
build Remove webpack Oct 9, 2017
src Merge pull request #20 from HugoGiraudel/patch-7 Oct 12, 2017
.babelrc with README Sep 8, 2017
.gitignore Trim down .gitignore Oct 9, 2017
LICENSE Initial commit Sep 8, 2017 Preservation Aug 1, 2018
package.json bumped version Oct 12, 2017

React Theme Switch

A small, self-contained, and accessible component for inverting the theme of React-based interfaces. Uses progressive enhancement to provide a button which flips the theme's colors only where filter: invert(100%) is supported. Local storage persists the mode across browsing sessions.


npm i react-theme-switch


import ThemeSwitch from 'react-theme-switch';


<ThemeSwitch />


Just one optional prop is provided: preserveRasters. By default, raster images (images without the SVG extension, as well as videos) get inverted. To preserve them (through reinversion) use the preserveRasters Boolean.

<ThemeSwitch preserveRasters />


The switch is provided as a screen reader and keyboard accessible <button> element and toggles the aria-expanded state.