1. Go to this page and download the library: Download asignua/filament-themes library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
asignua / filament-themes example snippets
use Asignua\FilamentThemes\ThemesPlugin;
$panel->plugin(ThemesPlugin::make());
use Asignua\FilamentThemes\Themes\Dracula;
use Asignua\FilamentThemes\Themes\Nord;
use Asignua\FilamentThemes\Themes\Sunset;
use Asignua\FilamentThemes\ThemesPlugin;
$panel->plugin(
ThemesPlugin::make()
->themes([Nord::class, Dracula::class, Sunset::class]) // what this panel offers (default: all six)
->default(Nord::class) // used until the user picks one
->defaultColor('emerald') // optional primary colour until the user picks one
->mode('user') // 'user' (default) or 'global'
->canChangeTheme(fn ($user) => $user->is_admin) // who may open the page
->navigation(group: 'Settings', sort: 90) // also list it in the sidebar
->userMenu(false) // or hide it from the user menu
->colors(['blue', 'emerald', 'rose']) // palette swatches offered (default: every chromatic palette)
->customColor(false) // no free #rrggbb field
->icon('heroicon-o-swatch'),
);
namespace App\Themes;
use Asignua\FilamentThemes\Contracts\Theme;
use Filament\Support\Colors\Color;
class Midnight implements Theme
{
public static function getName(): string
{
return 'midnight'; // the stored identifier; keep it stable
}
public static function getPath(): ?string
{
return resource_path('css/themes/midnight.css'); // or null for colours only
}
public function getThemeColor(): array
{
return [
'primary' => Color::Indigo, // a full palette...
'danger' => '#cc0033', // ...or a hex: it becomes a palette automatically
'gray' => Color::Slate,
];
}
}
ThemesPlugin::make()->registerTheme([\App\Themes\Midnight::class]); // add to the six
ThemesPlugin::make()->registerTheme([\App\Themes\Midnight::class], true); // replace them
ThemesPlugin::make()->themes([\App\Themes\Midnight::class, Nord::class]); // the same, explicit
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.