A comprehensive toolkit for working with Tailwind CSS more efficiently. Generate intelligent color palettes, convert CSS to Tailwind classes, and visualize design components in real-time.
- Parametric OKLCH Scale: Lightness, chroma and hue are each driven by a tunable curve across the full 50β950 ramp
- Pick Your Base Tile: Pin the input color to any stop and the rest of the ramp bends around it, keeping your color exact
- Advanced Trajectory Controls: Ramp endpoints and curve shape, saturation, chroma peak and falloff, plus hue drift at each end
- Scale Presets: Tailwind, Soft, Vivid, Neutral and Flat starting points
- Gamut Mapping: Chroma is reduced to fit sRGB or Display P3 instead of clipping RGB channels, so hex and OKLCH always agree
- Dual Color Mode: Blend a second color as a second anchor while still spanning the whole ramp
- Native Color Pickers: Click any color swatch to customize with native browser color picker
- Multiple Format Support: View colors in both HEX and OKLCH formats
- Tailwind v4 Output: Generate modern
@themeblocks with CSS custom properties - Live Bento Preview: See your colors applied to real UI components instantly
- Smart Contrast: Automatic text color adjustment for optimal readability
- Comprehensive Property Support: Convert a wide range of CSS properties to Tailwind classes
- Specialized Handlers: Enhanced conversion for borders, gradients, shadows, and measurements
- RGBA Color Conversion: Automatic conversion of RGBA colors to closest Tailwind equivalents
- Arbitrary Value Fallbacks: Uses Tailwind's arbitrary value syntax when exact matches aren't available
- Batch Processing: Convert multiple CSS declarations at once
- Live Updates: Automatically updates as you modify colors
- Comprehensive UI Examples: Dashboard cards, charts, forms, calendars, and more
- Contrast Validation: Ensures proper text readability across all color combinations
- Responsive Design: Preview how your colors work across different screen sizes
- Node.js 18+
- npm, yarn, or pnpm
-
Clone the repository
git clone <repository-url> cd tailwind-css-toolkit
-
Install dependencies
npm install # or yarn install # or pnpm install
-
Start the development server
npm run dev # or yarn dev # or pnpm dev
-
Open in browser Navigate to
http://localhost:5173(or the port shown in your terminal)
- Choose your base color using the color picker or enter a hex/OKLCH value
- Pick the base tile with the pin on any swatch, or leave it on Auto to place the color by lightness
- Open Advanced to reshape the whole scale β lightness curve, saturation and chroma falloff, hue drift, gamut
- Optional: Enable "Blend a second color" to anchor a second color further along the ramp
- Name your color scheme (defaults to "theme")
- Lock or customize any stop by clicking a swatch; locked stops survive regeneration
- Copy the output in either Tailwind v4 @theme format or CSS variables
- Preview in context using the live layout below
@theme {
--color-theme-50: #f7faff;
--color-theme-100: #dae9ff;
--color-theme-200: #b7d4ff;
--color-theme-300: #8fbcff;
--color-theme-400: #63a0ff;
--color-theme-500: #3b82f6;
--color-theme-600: #1866ee;
--color-theme-700: #1150cf;
--color-theme-800: #123ea9;
--color-theme-900: #143181;
--color-theme-950: #152758;
}Shade 500 is the exact base color you put in, because that is where the scale is anchored.
- Paste your CSS properties into the input area
- Review conversions - the tool shows both original CSS and Tailwind equivalent
- Copy results to use in your project
- Handle edge cases - properties that don't have direct Tailwind equivalents use arbitrary values
/* Input CSS */
background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
/* Output Tailwind */
bg-gradient-to-br from-red-400 to-teal-400
rounded-xl
shadow-mdβββ App.tsx # Main application component
βββ components/
β βββ PaletteGenerator.tsx # Color palette generation tool
β βββ ScaleControls.tsx # Advanced scale trajectory controls
β βββ ScaleCurveChart.tsx # L/C/H curve preview
β βββ CssToTailwind.tsx # CSS to Tailwind converter
β βββ BentoLayout.tsx # Live preview component
β βββ ColorPicker.tsx # Native color picker component
β βββ ColorSwatch.tsx # Individual color display
β βββ figma/
β β βββ ImageWithFallback.tsx
β βββ ui/ # shadcn/ui components
βββ utils/
β βββ color-scale.ts # Parametric OKLCH scale engine
β βββ color-utils.ts # Color conversion and contrast helpers
β βββ oklch-culori.ts # culori boundary: parsing and gamut mapping
β βββ css-to-tailwind.ts # CSS conversion logic
βββ styles/
βββ globals.css # Tailwind v4 configuration and base styles
- Framework: React 18 with TypeScript
- Styling: Tailwind CSS v4 with custom CSS properties
- UI Components: shadcn/ui component library
- Color Processing: Custom OKLCH color space utilities
- Icons: Lucide React
- Build Tool: Vite
Your base color is an anchor, not just one entry in a list. The generator builds lightness, chroma and hue curves across the ramp, then remaps them so the anchored stop reproduces your color exactly while every other stop stays monotone around it. Pin the color to a different tile and the ramp re-fits: pinning a mid-tone to 700 compresses the lights and stretches the darks.
By default the anchor is the stop whose lightness sits closest to your color.
- Lightness β the endpoints for stops 50 and 950, a curve control that decides how long the scale stays light, and an easing control that compresses both ends
- Chroma β an overall saturation multiplier plus the position of the chroma peak and how far chroma falls off toward each end. Falling off into the darks is what keeps them from going muddy
- Hue β a drift in degrees applied at each end of the ramp, pinned to zero at the anchor. Shifting the two ends in opposite directions is what gives a scale its warm/cool temperature
Defaults were fitted by least squares against Tailwind v4's own blue, red, emerald and violet ramps.
Uses OKLCH (Oklab Lightness Chroma Hue) for perceptually uniform color generation. Out-of-gamut stops have their chroma reduced until they fit the target gamut, which preserves lightness and hue β unlike clipping RGB channels, which shifts the hue and makes a stop's hex and OKLCH forms disagree.
Generates modern Tailwind v4 @theme blocks instead of legacy JavaScript configuration, making it easy to integrate with the latest Tailwind CSS.
- Scale math: Extend
utils/color-scale.ts - Color utilities: Extend
utils/color-utils.ts - CSS conversions: Add handlers in
utils/css-to-tailwind.ts - UI components: Follow shadcn/ui patterns in
components/ui/
The project uses Tailwind v4 with CSS custom properties defined in styles/globals.css. Modify the :root and .dark selectors to customize the design system.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Modern browsers with CSS custom properties support
- Chrome 49+, Firefox 31+, Safari 9.1+, Edge 16+
MIT License - feel free to use this project for personal or commercial purposes.
Built with β€οΈ using React and Tailwind CSS v4
Need help or have suggestions? Open an issue or contribute to make this toolkit even better!
