-
app/Services/Tailwind.php
Open in GitHubclass Tailwind { // public function __construct(public string $name, public string $baseColor) { $this->shades = $this->generateColorShades($name, $this->baseColor); } public function getCssFormat(): string { $output = '<style>' . PHP_EOL; $output.= ':root {' . PHP_EOL; foreach ($this->shades as $shade => $color) { $output.= "\t--color-{$shade}: {$color};" . PHP_EOL; } $output.= '}' . PHP_EOL; $output.= '</style>'; return $output; } // }
-
app/Http/Controllers/Auth/PasswordProtectionController.php
Open in GitHubuse App\Services\Tailwind; use App\Http\Controllers\Controller; class PasswordProtectionController extends Controller { public function __invoke() { $tw = new Tailwind('brand', app(\App\Settings\ColorSettings::class)->primary); return view('auth.password-protection', [ 'brandColors' => $tw->getCssFormat() ]); } // }