Skip to content

Commit

Permalink
Fix primary colors bug
Browse files Browse the repository at this point in the history
  • Loading branch information
arduinomaster22 committed Dec 19, 2024
1 parent 8b12742 commit 810c44b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/views/auth/login-two-factor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{ $this->form }}

<div class="flex items-center justify-between mt-6">
<x-filament::button type="submit" class="w-full" style="background-color: {{ filament()->getCurrentPanel()->getColors()['primary'] }};">
<x-filament::button type="submit" class="w-full" color="primary">
{{ __('Login') }}
</x-filament::button>
</div>
Expand Down
22 changes: 21 additions & 1 deletion src/TwoFactorAuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
use Filament\Support\Assets\Asset;
use Filament\Support\Assets\Css;
use Filament\Support\Assets\Js;
use Filament\Support\Colors\Color;
use Filament\Support\Facades\FilamentAsset;
use Filament\Support\Facades\FilamentColor;
use Filament\Support\Facades\FilamentIcon;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Filesystem\Filesystem;
Expand Down Expand Up @@ -128,6 +130,24 @@ public function packageBooted(): void
$this->getAssetPackageName()
);

$colors = filament()->getCurrentPanel()->getColors();
if (isset($colors['primary'])) {
if (is_string($colors['primary'])) {
$color = Color::hex($colors['primary']);
} else {
$color = $colors['primary'];
}
} else {
$color = \Filament\Support\Colors\Color::Amber;
}

FilamentColor::register([
'default' => $color
]);




FilamentAsset::registerScriptData(
$this->getScriptData(),
$this->getAssetPackageName()
Expand Down Expand Up @@ -171,7 +191,7 @@ public function packageBooted(): void
* This route name is used multiple places in filament.
*/
Route::prefix(config('filament.path'))->group(function () {
Route::get('/filament-login', fn () => Redirect::route('login'))
Route::get('/filament-login', fn() => Redirect::route('login'))
->name('auth.login');
});
});
Expand Down

0 comments on commit 810c44b

Please sign in to comment.