Gathering detailed insights and metrics for tailwind-colorscheme-plugin
Gathering detailed insights and metrics for tailwind-colorscheme-plugin
Gathering detailed insights and metrics for tailwind-colorscheme-plugin
Gathering detailed insights and metrics for tailwind-colorscheme-plugin
npm install tailwind-colorscheme-plugin
Typescript
Module System
Node Version
NPM Version
42.5
Supply Chain
95.3
Quality
74.6
Maintenance
100
Vulnerability
98.9
License
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
200%
3
Compared to previous week
Last month
20%
6
Compared to previous month
Last year
0%
148
Compared to previous year
2
A Tailwind CSS plugin that generates accessible, stylish button components using chroma-js. This plugin ensures all buttons meet WCAG 2.1 contrast requirements, supports all basic Tailwind CSS colors, allows for custom colors, and includes styling for all button states using classes and pseudo-classes.
Install the plugin via npm:
1npm install tailwind-colorscheme-plugin
1pnpm install tailwind-colorscheme-plugin
1// tailwind.config.js 2 3module.exports = { 4 theme: { 5 // Your existing theme configuration 6 }, 7 plugins: [ 8 require('tailwind-colorscheme-plugin')({ 9 customColors: { 10 customBlue: '#1e40af', 11 customGreen: '#10b981', 12 // Add more custom colors as needed 13 }, 14 }), 15 ], 16};
1<button class="btn-blue">Blue Button</button> 2<button class="btn-red">Red Button</button> 3<button class="btn-green">Green Button</button> 4<button class="btn-customBlue">Custom Blue Button</button>
The plugin includes styling for various button states using pseudo-classes:
&:hover
adjusts the background color for hover effects.&:active
modifies the background color when the button is active.&:focus
adds an outline to improve accessibility and user experience.The plugin uses chroma-js to calculate color contrast ratios, ensuring that all buttons meet or exceed WCAG 2.1 guidelines. This is crucial for creating accessible web applications that are usable by everyone.
You can extend the default color palette by providing custom colors in the plugin options:
1require('tailwind-colorscheme-plugin')({ 2 customColors: { 3 // Define your custom colors here 4 customPurple: '#6b21a8', 5 customOrange: '#ea580c', 6 }, 7});
These colors can then be used just like the default colors:
1<button class="btn-customPurple">Custom Purple Button</button> 2<button class="btn-customOrange">Custom Orange Button</button>
1<!DOCTYPE html> 2<html lang="en"> 3<head> 4 <meta charset="UTF-8"> 5 <title>Tailwind Button Plugin Example</title> 6 <link href="path/to/your/output.css" rel="stylesheet"> 7</head> 8<body> 9 <button class="btn-blue">Blue Button</button> 10 <button class="btn-red">Red Button</button> 11 <button class="btn-green">Green Button</button> 12 <button class="btn-customBlue">Custom Blue Button</button> 13 <button class="btn-customPurple">Custom Purple Button</button> 14</body> 15</html>
Contributions are welcome! If you have suggestions or find any issues, please open an issue or submit a pull request on the GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for details.
No vulnerabilities found.
No security vulnerabilities found.