Skip to content

Commit

Permalink
Fix primary colors bug (#70)
Browse files Browse the repository at this point in the history
* Fix primary colors bug

* Fix styling

* wip

* wip

* wip

* Fix styling

* Check if currentPanel is not null

* Fix styling

---------

Co-authored-by: arduinomaster22 <[email protected]>
Co-authored-by: Baspa <[email protected]>
Co-authored-by: Baspa <[email protected]>
  • Loading branch information
4 people authored Dec 19, 2024
1 parent 8b12742 commit 1de617e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions resources/views/auth/login-two-factor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
@endif
<form method="POST" action="{{ route('two-factor.login') }}" class="space-y-8">
@csrf

<div style="display: none">
<input type="text" id="recovery_code" name="recovery_code" value="">
</div>

{{ $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="default">
{{ __('Login') }}
</x-filament::button>
</div>
Expand Down
12 changes: 12 additions & 0 deletions src/TwoFactorAuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1de617e

Please sign in to comment.