4.0.0 • Published 8 months ago

@bobthered/tailwindcss-palette-generator v4.0.0

Weekly downloads
147
License
MIT
Repository
github
Last release
8 months ago

DemoKey FeaturesInstallationUsageExamples

Demo

Interactive demo generating tailwindcss palettes

Key Features

  • Generate color palette with as little as a hex value ( See Example )
  • Generate multiple color palettes ( See Example )
  • Customize the palette shade names & lightnesses ( See Example )
  • Default color naming applied automatically or can be overwritten ( See Example )
  • Zero (0) dependencies
  • Typescript support
  • Preserve Supplied Color

Installation

npm i @bobthered/tailwindcss-palette-generator

Options

The tailwindcssPaletteGenerator() function receives only one parameter.

Option TypeType
Stringstring
Array of Stringsstring[]
Object{  colors?: string[],  names?: string[],  preserve?: boolean,  shades?: Record<string | number, number>[],}

Usage

Example - Basic

// tailwind.config.js
import { tailwindcssPaletteGenerator } from '@bobthered/tailwindcssPaletteGenerator';

export default {
	content: ['./src/**/*.{html,js,svelte,ts}'],
	theme: {
		extend: {
			colors: tailwindcssPaletteGenerator('#FF0040')
		}
	},
	plugins: []
};

Example - Multiple Colors

// tailwind.config.js
import { tailwindcssPaletteGenerator } from '@bobthered/tailwindcssPaletteGenerator';

export default {
	content: ['./src/**/*.{html,js,svelte,ts}'],
	theme: {
		extend: {
			colors: tailwindcssPaletteGenerator(['#FF0040', '#FFBB00'])
		}
	},
	plugins: []
};

Example - Custom Shades and Lightness

// tailwind.config.js
import { tailwindcssPaletteGenerator } from '@bobthered/tailwindcssPaletteGenerator';

export default {
	content: ['./src/**/*.{html,js,svelte,ts}'],
	theme: {
		extend: {
			colors: tailwindcssPaletteGenerator({
				colors: ['#FF0040'],
				shades: [
					{ name: 'light', lightness: 95 },
					{ name: 'normal', lightness: 46 },
					{ name: 'dark', lightness: 7 }
				]
			})
		}
	},
	plugins: []
};

Example - Override color names

// tailwind.config.js
import { tailwindcssPaletteGenerator } from '@bobthered/tailwindcssPaletteGenerator';

export default {
	content: ['./src/**/*.{html,js,svelte,ts}'],
	theme: {
		extend: {
			colors: tailwindcssPaletteGenerator({
				colors: ['#FF0040', '#FFBB00'],
				names: ['red', 'yellow']
			})
		}
	},
	plugins: []
};
3.3.2

8 months ago

4.0.0

8 months ago

3.2.3

2 years ago

3.2.2

2 years ago

3.2.0

2 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.0.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago