Skip to content

Tailwind CSS plugin to generate gradient background utilities

Notifications You must be signed in to change notification settings

stevenvandemoortele/tailwindcss-gradients

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gradients Tailwind CSS Plugin

Installation

npm install tailwindcss-gradients

Usage

// In your Tailwind CSS config
{
  plugins: [
    require('tailwindcss-gradients')({
      variants: ['responsive'],
      directions: {
        't': 'to top',
        'r': 'to right',
        'b': 'to bottom',
        'l': 'to left',
      },
      gradients: {
        'red': '#f00',
        'red-blue': ['#f00', '#00f'],
        'red-green-blue': ['#f00', '#0f0', '#00f'],
      },
    }),
  ],
}

This plugin generates the following utilities:

/* configurable with the "directions" and "gradients" options */
.bg-gradient-[direction-name]-[gradient-name] {
  background-image: linear-gradient([direction-value], [gradient-color-1], [gradient-color-2], [...])
}

Note: The directions option is optional and defaults to:

{
  't': 'to top',
  'tr': 'to top right',
  'r': 'to right',
  'br': 'to bottom right',
  'b': 'to bottom',
  'bl': 'to bottom left',
  'l': 'to left',
  'tl': 'to top left',
}

About

Tailwind CSS plugin to generate gradient background utilities

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%