Dimmer is a simple package to easily add a light/dark/system mode switcher to your Laravel app.
- Alpine JS
- Tailwind CSS
You can install the package via composer:
composer require awcodes/dimmer
Next, you need to add the views to your tailwind.config.js
file:
content: [
'./vendor/awcodes/dimmer/resources/views/**/*.blade.php',
]
Optionally (not recommended), you can publish the views using
php artisan vendor:publish --tag="dimmer-views"
You can also update the translations by publishing the lang files:
php artisan vendor:publish --tag="dimmer-translations"
Just include the dimmer
component in your layout or anywhere you would to use it.
<x-dimmer::controls />
Should you wish to force a default mode for when a user first visits the site, you can do so by setting the force-mode
attribute on the dimmer
component. Without this attribute set, the default mode will be determined by the user's system preferences.
<x-dimmer::controls force-mode="dark" />
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.