awcodes/light-switch

Plugin to add theme switching (light/dark/system) to the auth pages for Filament Panels
131,728 48
Install
composer require awcodes/light-switch
Latest Version:v3.1.0
PHP:^8.2
License:MIT
Last Updated:Sep 9, 2026
Links: GitHub  ·  Packagist
Maintainer: awcodes

Light Switch

Plugin to add theme switching (light/dark/system) to the auth pages for Filament Panels

Latest Version MIT Licensed Total Downloads GitHub Repo stars

Compatibility

Package Version Filament Version
1.x 3.x
2.x 4.x
3.x 4.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),
        ]);
}

Choosing which pages show the switcher

You can control which pages show the switcher by passing an array of route strings to the enabledOn() method. Anything in this array will get evaluated as should be shown. This replaces the default list rather than adding to it, so include every route you want.

By default the switcher is shown on routes containing auth.login, auth.password or auth.register.

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.

Development

Install dependencies and run the test suite:

composer install
composer test

Start the Workbench application:

composer serve

Open /admin and sign in with test@example.com / password. The login form is prefilled for convenience.

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.

Related Packages

awcodes/filament-gravatar

Replace Filament's default avatar url provider with one for Gravatar.

231,204 32
awcodes/filament-badgeable-column

Filament Tables column to append and prepend badges.

689,428 148
awcodes/filament-table-repeater

A modified version of the Filament Forms Repeater to display it as a table.

980,957 267
awcodes/filament-curator

A media picker plugin for FilamentPHP.

442,682 443
awcodes/matinee

OEmbed field for Filament Panel and Form Builders.

10,927 22