composer require nuxtifyts/dash-stack-theme
php artisan vendor:publish --provider="Nuxtifyts\DashStackTheme\DashStackThemeServiceProvider" --tag="config"
app/Providers/AppServiceProvider.php:
use Nuxtifyts\DashStackTheme\DashStackTheme;
public function boot()
{
DashStackTheme::make()
->register();
}
AppServiceProvider or Filament panel configuration includes the theme registration before any Filament components are rendered.resources/views/vendor/filament/ for default views (if published).To apply the theme globally to your Filament admin panel:
// In AppServiceProvider or a dedicated Filament service provider
use Nuxtifyts\DashStackTheme\DashStackTheme;
public function boot()
{
DashStackTheme::make()
->register()
->setDarkMode(true); // Optional: Enable dark mode by default
}
Verify the theme appears in your Filament dashboard after clearing cached views:
php artisan view:clear
Theme Registration:
AppServiceProvider).DashStackTheme::make()->register() to integrate with Filament’s view composer.Dynamic Theme Switching:
DashStackTheme::make()
->setDarkMode(auth()->user()->prefers_dark_mode)
->register();
Customizing Assets:
php artisan vendor:publish --tag="dash-stack-theme-assets"
resources/views/vendor/filament/ or public/vendor/filament/ for custom styles.Integration with Filament Panels:
// In a dedicated Filament service provider
public function boot()
{
DashStackTheme::make()->register();
// Other Filament configurations...
}
Filament Panels: The theme is designed to work seamlessly with Filament’s default panels. No additional configuration is required for basic usage.
Dark Mode: Enable/disable dark mode globally or per user:
DashStackTheme::make()->setDarkMode(true);
Use Filament’s built-in dark mode utilities (e.g., useDarkMode() in Blade) for consistency.
Localization:
The theme supports localization via Filament’s translation system. Override default strings in resources/lang/ if needed.
Asset Optimization:
Use Laravel Mix or Vite to bundle and optimize the theme’s CSS/JS. Example vite.config.js:
import { defineConfig } from 'vite';
import Laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
Laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
],
});
Registration Timing:
DashStackTheme::make()->register() is called before any Filament panels or views are rendered. Place it in AppServiceProvider::boot() or a dedicated Filament service provider.Asset Conflicts:
/* In your custom CSS */
.filament .dash-stack-theme { ... }
Cached Views:
php artisan view:clear
php artisan config:clear if theme settings are cached.Dark Mode Inconsistencies:
useDarkMode()) are consistent with the theme’s implementation. Check for conflicting CSS variables.Inspect Elements:
dash-stack-theme, dark-mode) are applied to the <body> or root elements.Check Published Assets:
public/vendor/filament/ or resources/views/vendor/filament/. Run:
php artisan vendor:publish --tag="dash-stack-theme-assets" --force
Log Theme Registration:
DashStackTheme::make()->register();
\Log::info('DashStackTheme registered:', ['config' => DashStackTheme::getConfig()]);
Filament Debug Mode:
Filament::serving(function () {
\Log::info('Filament panels:', Filament::getPanels());
});
Extend the Theme:
DashStackTheme:
use Nuxtifyts\DashStackTheme\DashStackTheme as BaseTheme;
class CustomDashStackTheme extends BaseTheme
{
public function configure()
{
parent::configure();
$this->setPrimaryColor('#4f46e5'); // Customize colors
}
}
AppServiceProvider:
CustomDashStackTheme::make()->register();
Theme Configuration:
php artisan vendor:publish --tag="dash-stack-theme-config"
config/dash-stack-theme.php to adjust settings like:
'dark_mode' => env('DASH_STACK_THEME_DARK_MODE', false),
'primary_color' => '#3b82f6',
Performance:
DashStackTheme::make()
->register()
->setLazyLoadAssets(true);
Testing:
use Filament\Testing\Tests\TestCase;
public function test_theme_applied()
{
$this->actingAs(User::factory()->create())
->get('/admin')
->assertSee('dash-stack-theme');
}
Community Resources:
How can I help you explore Laravel packages today?