PHPackages                             nrep/filament-theme-switcher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nrep/filament-theme-switcher

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nrep/filament-theme-switcher
============================

A FilamentPHP plugin that allows users to easily switch and customize application themes

v4.0.10(4mo ago)0106MITPHPPHP ^8.1

Since Jan 11Pushed 4mo agoCompare

[ Source](https://github.com/nrep/filament-theme-switcher)[ Packagist](https://packagist.org/packages/nrep/filament-theme-switcher)[ Docs](https://github.com/nrep/filament-theme-switcher)[ RSS](/packages/nrep-filament-theme-switcher/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (27)Used By (0)

Filament Theme Switcher
=======================

[](#filament-theme-switcher)

[![Latest Version on Packagist](https://camo.githubusercontent.com/43c8ce55e74c125e9e381e3c51ffc02108e3380ca177448ffad6593b50dce442/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e7265702f66696c616d656e742d7468656d652d73776974636865722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nrep/filament-theme-switcher)[![Total Downloads](https://camo.githubusercontent.com/67a08698a912eb77cc377de7661a79ce38757c262c3e8dc4159d785c19d44065/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e7265702f66696c616d656e742d7468656d652d73776974636865722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nrep/filament-theme-switcher)

A FilamentPHP plugin that allows users to easily switch and customize application themes. Supports both global themes and per-user theme preferences.

Features
--------

[](#features)

- 🎨 **7 Pre-built Themes**: Default, Sunset, Ocean, Forest, Midnight, Rose, and Amber
- 🔄 **Easy Theme Switching**: Quick switch via dropdown or dedicated settings page
- 🎯 **Per-User Themes**: Optional per-user theme preferences with database storage
- 🖌️ **Custom Colors**: Override any theme color with custom color picker
- 🔐 **Authorization**: Control who can access theme settings
- 🌍 **Translatable**: Full translation support
- ⚡ **Filament v3 &amp; v4 Compatible**: Works with both major versions

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10.x, 11.x, or 12.x
- Filament 3.x or 4.x

Installation
------------

[](#installation)

Install the package via composer:

```
composer require nrep/filament-theme-switcher
```

Publish the config file (optional):

```
php artisan vendor:publish --tag="filament-theme-switcher-config"
```

For per-user theme support, publish and run the migrations:

```
php artisan vendor:publish --tag="filament-theme-switcher-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

Register the plugin in your Panel provider:

```
use Isura\FilamentThemeSwitcher\FilamentThemeSwitcherPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ... other configuration
        ->plugin(
            FilamentThemeSwitcherPlugin::make()
        );
}
```

Add the middleware to apply themes:

```
use Isura\FilamentThemeSwitcher\Http\Middleware\SetTheme;

public function panel(Panel $panel): Panel
{
    return $panel
        // ... other configuration
        ->middleware([
            // ... other middleware
            SetTheme::class,
        ]);
}
```

### Configuration Options

[](#configuration-options)

#### Theme Mode

[](#theme-mode)

Set the theme mode in the config file or via the plugin:

```
// config/filament-theme-switcher.php
return [
    'mode' => 'global', // or 'user' for per-user themes
    'default_theme' => 'default',
];
```

#### Plugin Configuration

[](#plugin-configuration)

```
FilamentThemeSwitcherPlugin::make()
    // Set the theme mode
    ->mode('user') // 'global' or 'user'

    // Customize navigation
    ->navigationGroup('Settings')
    ->navigationIcon('heroicon-o-paint-brush')
    ->navigationSort(100)
    ->navigationLabel('Appearance')

    // Control page access
    ->registerNavigation(true) // Show/hide from navigation
    ->canViewThemesPage(fn () => auth()->user()?->is_admin)

    // Register custom themes
    ->registerThemes([
        'my-theme' => MyCustomTheme::class,
    ])

    // Override default themes entirely
    ->registerThemes([
        'my-theme' => MyCustomTheme::class,
    ], override: true);
```

### Creating Custom Themes

[](#creating-custom-themes)

Create a new theme by extending `AbstractTheme`:

```
