/react-theme-switcher

🌓 React theme switcher component

Primary LanguageJavaScriptMIT LicenseMIT

React theme switcher component

A react theme switcher component

Installation

# using yarn
yarn add react-theme-switcher

# using npm
npm install react-theme-switcher

Usage

By default theme switcher is applied to body and colors are already setted

import React from "react";
import ThemeSwitcher from "react-theme-switcher";

function App() {
	return (
		<div className="App">
			<header className="App-header">
				<ThemeSwitcher />
				<h2>React theme switcher</h2>
			</header>
		</div>
	);
}

export default App;

Props you can pass to the component:

<ThemeSwitcher
	cssSelector="body"
	switcherColor="#2775cc"
	darkColor="#282c34"
	lightColor="#ffffff"
	lightTextColor="#272b33"
	darkTextColor="#ffffff"
/>

Demo

Preview it on CodeSandbox https://codesandbox.io/s/6yr87ozmkk

Author

Abdessalam BENHARIRA