Light Switch
CommunityPlugin to add theme switching (light/dark/system) to the auth pages for Filament Panels.
filament/
namespace. Review the source and install at your own risk. Found
malware or an unresolved security issue the author won't
address?
Report it
.
Author:
Adam Weston
Documentation
Plugin to add theme switching (light/dark/system) to the auth pages for Filament Panels
#Compatibility
| Package Version | Filament Version |
|---|---|
| 1.x | 3.x |
| 2.x | 4.x |
| 3.x | 5.x |
#Installation
You can install the package via composer:
composer require awcodes/light-switch
[!IMPORTANT] If you have not set up a custom theme and are using Filament Panels follow the instructions in the Filament Docs first.
After setting up a custom theme add the plugin's views to your theme css file or your app's css file if using the standalone packages.
@source '../../../../vendor/awcodes/light-switch/resources/**/*.blade.php';
#Usage
use Awcodes\LightSwitch\LightSwitchPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
LightSwitchPlugin::make(),
]);
}
#Position
By default, the switcher will be added to the top right of the auth pages. You can change this by passing one of the Alignment enums cases to the position() method.
use Awcodes\LightSwitch\LightSwitchPlugin;
use Awcodes\LightSwitch\Enums\Alignment;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
LightSwitchPlugin::make()
->position(Alignment::BottomCenter),
]);
}
#Disabling on specific pages
You can disable the switcher on specific pages by passing an array of route strings to the on() method. Anything in this array will get evaluated as should be shown. Otherwise, it will be enabled on all auth pages available to your panel.
When determining if the switcher should be shown the Str::contains() method is used to match the route name, so you can pass a partial route string to match multiple pages and not have to pass the complete route name. This is useful if you need to target routes containing a specific panel route, like admin.auth.email or app.auth.email.
use Awcodes\LightSwitch\LightSwitchPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
LightSwitchPlugin::make()
->enabledOn([
'auth.email',
'auth.login',
'auth.password',
'auth.profile',
'auth.register',
]),
]);
}
#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
#License
The MIT License (MIT). Please see License File for more information.
The author
Adam is a full-stack web developer (with a focus on Laravel) who has been coding for close to 20 years. He is a core Filament team member as well and has authored numerous plugins for Filament such as Curator, Tiptap Editor and Table Repeater, to name a few. You can learn more about Adam on his website.
From the same author
Botly
Botly is a Filament plugin to manage your site's robots.txt file directly from a Filament admin panel.
Author:
Adam Weston
Table Repeater
A modified version of the Filament Forms Repeater to display it as a table.
Author:
Adam Weston
Tiptap Editor
A Rich Text Editor plugin for Filament Forms.
Author:
Adam Weston
Quick Create
Plugin for Filament Panels that adds a dropdown menu to the header to quickly create new items.
Author:
Adam Weston
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Spotlight Pro
Browse your Filament Panel with ease. Filament Spotlight Pro adds a Spotlight/Raycast like Command Palette to your Filament Panel.
Dennis Koch
Custom Fields
Eliminate custom field migrations forever. Let your users create and manage form fields directly in Filament admin panels with 20+ built-in field types, validation, and zero database changes.
Relaticle