All Projects → bradlc → Tailwindcss Alpha

bradlc / Tailwindcss Alpha

Automatic alpha variants for your Tailwind CSS colors

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Tailwindcss Alpha

Admin Template Night
Tailwind CSS Starter Template - Admin Dashboard Template (Night Mode)
Stars: ✭ 40 (-41.18%)
Mutual labels:  tailwindcss
Tailwindcss Intellisense
Intelligent Tailwind CSS tooling for Visual Studio Code
Stars: ✭ 1,066 (+1467.65%)
Mutual labels:  tailwindcss
Nordic Store
Tailwind CSS Starter Template - Nordic Shop / Store
Stars: ✭ 61 (-10.29%)
Mutual labels:  tailwindcss
Intercom Clone
Intercom clone built with NextJS and TailwindCSS
Stars: ✭ 48 (-29.41%)
Mutual labels:  tailwindcss
Empathy
❤️ Lightweight admin dashboard build with Tailwindcss, PurgeCSS, Vuejs, Fontawesome 5.
Stars: ✭ 51 (-25%)
Mutual labels:  tailwindcss
Tw Universal Tokens
Use Tailwind tokens as CSS variables, SASS map, SASS variables, ES module, JSON & Common JS module.
Stars: ✭ 56 (-17.65%)
Mutual labels:  tailwindcss
Next Purescript Example
Simple example app using Next.js with Purescript
Stars: ✭ 35 (-48.53%)
Mutual labels:  tailwindcss
Tailwind Cheatsheet
A printable one-page cheatsheet for TailwindCSS.
Stars: ✭ 67 (-1.47%)
Mutual labels:  tailwindcss
Twind
The smallest, fastest, most feature complete Tailwind-in-JS solution in existence.
Stars: ✭ 1,051 (+1445.59%)
Mutual labels:  tailwindcss
Tailwind Styled Component
Create Tailwind CSS React components like styled components with class names on multiple lines and conditional class rendering
Stars: ✭ 57 (-16.18%)
Mutual labels:  tailwindcss
Cra Template Tailwindcss Typescript
A streamlined Tailwind CSS template for Create React App in TypeScript
Stars: ✭ 48 (-29.41%)
Mutual labels:  tailwindcss
Tailwindcss
A Tailwind CSS frontend preset for the Laravel Framework
Stars: ✭ 1,056 (+1452.94%)
Mutual labels:  tailwindcss
Framework
An eCommerce administration built with Laravel 7 for create and manage online shop with multi-vendor.
Stars: ✭ 56 (-17.65%)
Mutual labels:  tailwindcss
Tail Kit
Tail-kit is a free and open source components and templates kit fully coded with Tailwind css 2.0.
Stars: ✭ 997 (+1366.18%)
Mutual labels:  tailwindcss
Tall
A TALL (Tailwind CSS, Alpine.js, Laravel and Livewire) Preset for Laravel
Stars: ✭ 1,133 (+1566.18%)
Mutual labels:  tailwindcss
Nuxt Cockpit Static Blog
A static blog built with Nuxt.js, Tailwindcss and Cockpit headless CMS
Stars: ✭ 39 (-42.65%)
Mutual labels:  tailwindcss
Larawind
Larawind - Laravel 8.0+ Jetstream and Tailwind CSS Admin Theme
Stars: ✭ 55 (-19.12%)
Mutual labels:  tailwindcss
Tailwindcss Sketch Kit
💎 Sketch UI kit for Tailwind CSS
Stars: ✭ 68 (+0%)
Mutual labels:  tailwindcss
Alpinejs Playground
A set of ready to use Alpine.js examples with TailwindCSS
Stars: ✭ 65 (-4.41%)
Mutual labels:  tailwindcss
Laravel Casts
Form builder for Laravel.
Stars: ✭ 56 (-17.65%)
Mutual labels:  tailwindcss

tailwindcss-alpha

Automatic alpha variants for your Tailwind CSS colors

Why?

If you’re like me your Tailwind CSS color configuration often ends up looking something like this:

module.exports = {
  // ...
  backgroundColors: {
    red: '#f00',
    'red-10': 'rgba(255, 0, 0, 0.1)',
    'red-20': 'rgba(255, 0, 0, 0.2)',
    'red-50': 'rgba(255, 0, 0, 0.5)',
    'red-80': 'rgba(255, 0, 0, 0.8)'
    // ...
  }
  // ...
}

tailwindcss-alpha automatically generates alpha variations for each of your background, text, and border colors.

Install

npm install --save-dev tailwindcss-alpha
// tailwind.js
module.exports = {
  // ...
  plugins: [
    require('tailwindcss-alpha')({
      modules: {
        backgroundColors: true
      },
      alpha: {
        '10': 0.1,
        '30': 0.3
      }
    })
  ]
  // ...
}

Options

modules (optional)

Default: { backgroundColors: true, textColors: false, borderColors: false }

Here is where you define which Tailwind modules you would like to generate alpha variants for, and which state variants (responsive, hover, etc.) to generate for each. This option behaves in the same way as the modules property in the main Tailwind configuration, with one difference: a value of true means "inherit from the main Tailwind modules configuration."

alpha (optional)

This is an object containing the alpha values for your new color utilities. If this is not specified in the plugin options the alpha property in your main Tailwind configuration will be used. If there is no alpha property then the opacity property is used.

The keys of this object appear at the end of the utility class names. For example if you have a background color with a key of red and an alpha with a key of 25 then a bg-red-25 class would be generated.

Example

module.exports = {
  // ...
  backgroundColors: {
    red: '#f00'
  },
  // ...
  plugins: [
    require('tailwindcss-alpha')({
      modules: {
        backgroundColors: []
      },
      alpha: {
        '25': 0.25,
        '50': 0.5,
        '75': 0.75
      }
    })
  ]
  // ...
}

The configuration above yields the following utilities:

.bg-red-25 {
  background-color: rgba(255, 0, 0, 0.25);
}

.bg-red-50 {
  background-color: rgba(255, 0, 0, 0.5);
}

.bg-red-75 {
  background-color: rgba(255, 0, 0, 0.75);
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].