Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

storybook-color-picker

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

storybook-color-picker

Custom palette color picker addon for storybook

  • 1.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.4K
increased by116.08%
Maintainers
1
Weekly downloads
 
Created
Source

storybook-color-picker

Description

An addon for Storybook that allows you to quickly find and copy to clipboard any color from your custom color palette.

storybook-color-picker

Technology

Created with TypeScript, React and Storybook.

Usage

$ npm i storybook-color-picker

In your .storybook folder find main.js file and add this addon like below

  module.exports = {
    ...
    "addons": [
      ...
      "storybook-color-picker"
    ]
  }

In your .storybook folder find preview.js file and add your color palette to parameters like below. Scroll down to find out how your corol palette must look like.

import yourFancyColorPalette from './yourFancyColorPalette.json';

export const parameters = {
  ...
  colorPalette: yourFancyColorPalette,
}

Color palette

as Object

type ColorPaletteAsObjecy = Record<string, Record<string, string> | string>;

Example:

  {
      "light": {
          " 500": "#aaa",
          " 100": "#eee",
          " 400": "#bbb",
          " 200": "#ddd",
          " 300": "#ccc"
      },
      "dark": {
          "0100": "#888",
          "0500": "#000",
          "0400": "#222",
          "0200": "#666",
          "0300": "#444"
      }
  }

Usefull tip: add white spaces or zeros before numerical keys to prevent auto sorting

as Array

  type ColorPaletteAsArray = {
      label: string,
      values: [
        {
          label: string,
          value: string, // valid hex value
        }
      ],
  }

Example:

  [
    {
      "label": "light",
      "values": [
        {
          "label": "100",
          "value": "#fff"
        },
        {
          "label": "200",
          "value": "#aaa"
        }
      ]
    },
    {
      "label": "dark",
      "values": [
        {
          "label": "100",
          "value": "#222"
        },
        {
          "label": "200",
          "value": "#000000"
        }
      ]
    }
  ]

Keywords

FAQs

Package last updated on 25 Jun 2021

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