agenticmorf/fluxui-theme
FluxUI theme and appearance settings for Laravel apps using Livewire Flux. Offers light/dark/system mode, accent and base color swatch pickers, and stores user preferences in an appearance_preferences JSON field on the User model.
Add the cast for appearance_preferences:
protected $casts = [
'appearance_preferences' => 'array',
];
Your app must import Flux CSS. In resources/css/app.css:
[@import](https://github.com/import) 'tailwindcss';
[@import](https://github.com/import) '../../vendor/livewire/flux/dist/flux.css';
[@source](https://github.com/source) '../../vendor/livewire/flux/stubs/**/*.blade.php';
[@custom-variant](https://github.com/custom-variant) dark (&:where(.dark, .dark *));
Include the appearance component before [@fluxAppearance](https://github.com/fluxAppearance) in your layout <head>:
[@vite](https://github.com/vite)(['resources/css/app.css', 'resources/js/app.js'])
<x-fluxui-theme::appearance />
[@fluxAppearance](https://github.com/fluxAppearance)
Wrap your main app shell with <flux:accent>:
[@php](https://github.com/php)
$appearance = app(\AgenticMorf\FluxuiTheme\AppearanceService::class)->getEffective(auth()->user());
[@endphp](https://github.com/endphp)
<body>
<flux:accent :color="$appearance['accent']">
{{-- Your app content --}}
</flux:accent>
</body>
Add a link to the appearance page:
<flux:navlist.item :href="route('appearance.edit')" wire:navigate>{{ __('Appearance') }}</flux:navlist.item>
The appearance page expects a settings layout with $heading, $subheading, and $slot. Optionally create partials.settings-heading for a shared settings header.
$appearance = app(\AgenticMorf\FluxuiTheme\AppearanceService::class)->getEffective(auth()->user());
// ['accent' => 'blue', 'base' => 'zinc', 'theme' => 'system']
How can I help you explore Laravel packages today?