Download the PHP package reinbier/php-tailwind-colors without Composer
On this page you can find all versions of the php package reinbier/php-tailwind-colors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download reinbier/php-tailwind-colors
More information about reinbier/php-tailwind-colors
Files in reinbier/php-tailwind-colors
Package php-tailwind-colors
Short Description For using & generating TailwindCSS colors in Laravel
License MIT
Homepage https://github.com/reinbier/php-tailwind-colors
Informations about the package php-tailwind-colors
For using & generating TailwindCSS colors in Laravel
NOTE: This package is based on same Color Generator FilamentPHP uses to generate shades of TailwindCSS colors.
Installation
You can install the package via composer:
Usage
The package enables you to generate your own default color variables or register your own custom TailwindCSS colors for use in your HTML. Simply add the Blade directive @tailwindColors
to your HTML to gain access to these variables.
This outputs:
With default colors from the Color
class, being:
Now you can use these variables in your CSS files. These default colors also come with a Tailwind preset
file.
To make use of these defaults as Tailwind classes like you're used to, you need to import this preset in your existing tailwind.config.js
.
Register colors
The generated CSS variables are mapped to Tailwind classes in the preset file and can be customized.
To generate entirely new colors, please read 'Registering extra colors' below.
Customizing the default colors
From a service provider's boot()
method, or middleware, you can call the TailwindColor::register()
method, which you can use to customize the default colors.
There are 6 default colors that are used, like mentioned above:
The Color
class contains every Tailwind CSS color to choose from.
Using a non-Tailwind color
You can use custom colors that are not included in the Tailwind CSS color palette by passing an array of color shades from 50
to 950
in RGB format:
Generating a custom color from a hex code
You can use the Color::hex()
method to generate a custom color palette from a hex code:
Generating a custom color from an RGB value
You can use the Color::rgb()
method to generate a custom color palette from an RGB value:
Registering extra colors
You can register extra colors that you can use throughout your app:
Now, when you want to use this color in your HTML (like text-mycolor-300
or bg-mycolor-950
), you should append it to your colors in your tailwind.config.js
file, and rebuild your assets:
==> Finally, build your assets and you're all set!
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- reinbier
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of php-tailwind-colors with dependencies
illuminate/contracts Version ^10.0||^11.0
spatie/color Version ^1.5
spatie/laravel-package-tools Version ^1.16