Skip to content

Instantly share code, notes, and snippets.

@BronsonQuick
Created September 23, 2024 03:29
Show Gist options
  • Save BronsonQuick/a2961d8d90592a5218ebe2c797ba1212 to your computer and use it in GitHub Desktop.
Save BronsonQuick/a2961d8d90592a5218ebe2c797ba1212 to your computer and use it in GitHub Desktop.
Generate a colour palette for Storybook based on custom colours in Tailwind

import { Meta, ColorPalette, ColorItem } from '@storybook/blocks'; import tailwindPreset from '../../tailwind.config.js';

Colours

All our CSS Custom Properties for colours are listed at "Swatches" column just below:

{Object.keys(tailwindPreset.theme.extend.colors).map((key) => { if (typeof tailwindPreset.theme.extend.colors[key] === 'string') { return ( ); } })}

Using Tailwind CSS utility classes

You can use colours with Tailwind CSS utility classes for Background Color & Text Color for example. But you can also use them for borders, gradients, etc. Go to Tailwind CSS documentation & quick search for anything!

All our Tailwind CSS colours names are just above next to their representation.

Screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment