From 1de617e74b4718a97a07710ff84d7c4dea73bcdc Mon Sep 17 00:00:00 2001 From: MHortulanus <91618246+arduinomaster22@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:49:16 +0100 Subject: [PATCH] Fix primary colors bug (#70) * Fix primary colors bug * Fix styling * wip * wip * wip * Fix styling * Check if currentPanel is not null * Fix styling --------- Co-authored-by: arduinomaster22 Co-authored-by: Baspa Co-authored-by: Baspa --- resources/views/auth/login-two-factor.blade.php | 4 ++-- src/TwoFactorAuthServiceProvider.php | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/resources/views/auth/login-two-factor.blade.php b/resources/views/auth/login-two-factor.blade.php index 7982ebf..ba1ac73 100644 --- a/resources/views/auth/login-two-factor.blade.php +++ b/resources/views/auth/login-two-factor.blade.php @@ -9,7 +9,7 @@ @endif
@csrf - +
@@ -17,7 +17,7 @@ {{ $this->form }}
- + {{ __('Login') }}
diff --git a/src/TwoFactorAuthServiceProvider.php b/src/TwoFactorAuthServiceProvider.php index 9dd2d79..c8feecf 100644 --- a/src/TwoFactorAuthServiceProvider.php +++ b/src/TwoFactorAuthServiceProvider.php @@ -2,11 +2,14 @@ namespace Vormkracht10\TwoFactorAuth; +use Filament\Facades\Filament; use Filament\Support\Assets\AlpineComponent; 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; @@ -128,6 +131,15 @@ public function packageBooted(): void $this->getAssetPackageName() ); + $colors = Filament::getCurrentPanel()?->getColors(); + $color = isset($colors['primary']) + ? (is_string($colors['primary']) ? Color::hex($colors['primary']) : $colors['primary']) + : \Filament\Support\Colors\Color::Amber; + + FilamentColor::register([ + 'default' => $color, + ]); + FilamentAsset::registerScriptData( $this->getScriptData(), $this->getAssetPackageName()