Socket
Socket
Sign inDemoInstall

storybook-dark-mode

Package Overview
Dependencies
Maintainers
1
Versions
506
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-dark-mode

Toggle between light and dark mode in Storybook


Version published
Weekly downloads
286K
increased by0.22%
Maintainers
1
Weekly downloads
ย 
Created

What is storybook-dark-mode?

storybook-dark-mode is an addon for Storybook that allows you to toggle between light and dark themes within your Storybook environment. This can be particularly useful for testing and demonstrating how your components look in different themes.

What are storybook-dark-mode's main functionalities?

Toggle between light and dark mode

This feature allows you to toggle between light and dark themes in your Storybook environment. The code sample demonstrates how to add the dark mode toggle using the `withThemesProvider` decorator.

import { addDecorator } from '@storybook/react';
import { withThemesProvider } from 'storybook-addon-styled-component-theme';
import { themes } from '@storybook/theming';

const themes = [themes.light, themes.dark];
addDecorator(withThemesProvider(themes));

Persist theme selection

This feature allows the selected theme to persist across sessions. The code sample shows how to enable persistence by passing an options object with `persist: true` to the `withThemesProvider` decorator.

import { addDecorator } from '@storybook/react';
import { withThemesProvider } from 'storybook-addon-styled-component-theme';
import { themes } from '@storybook/theming';

const themes = [themes.light, themes.dark];
addDecorator(withThemesProvider(themes, { persist: true }));

Custom themes

This feature allows you to define and use custom themes. The code sample demonstrates how to create custom themes and add them to the `withThemesProvider` decorator.

import { addDecorator } from '@storybook/react';
import { withThemesProvider } from 'storybook-addon-styled-component-theme';

const customThemes = [
  { name: 'Light', backgroundColor: '#ffffff', color: '#000000' },
  { name: 'Dark', backgroundColor: '#000000', color: '#ffffff' }
];
addDecorator(withThemesProvider(customThemes));

Other packages similar to storybook-dark-mode

Keywords

FAQs

Package last updated on 26 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