From dffcad486c02665bfaf461805505c354b71a3330 Mon Sep 17 00:00:00 2001 From: Dennis Elsinga Date: Tue, 10 Dec 2024 14:49:01 +0100 Subject: [PATCH] Add support for custom admin panel colors in setup --- Skeletorfile.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Skeletorfile.php b/Skeletorfile.php index b1b65e4..90d293c 100644 --- a/Skeletorfile.php +++ b/Skeletorfile.php @@ -1,5 +1,6 @@ all() ); + $adminPanelColor = $skeletor->select('What color would you like to use for the FilamentPHP admin panel?', + collect(Color::all()) + ->keys() + ->map(fn (string $color) => ucfirst($color)) + ->flatten() + ->values() + ->toArray() + ); + $skeletor->intro('Let\'s setup the default user that will be created.'); $name = $skeletor->text('What is the demo username?', 'John Doe', required: true); @@ -53,6 +63,14 @@ $skeletor->pregReplaceInFile('/^APP_TIMEZONE=(".*?"|[^"\s]*|)$/m', 'APP_TIMEZONE="'.$timezone.'"', '.env'); } + if ($adminPanelColor) { + $skeletor->pregReplaceInFile( + "/'primary'\s*=>\s*Color::[A-Za-z0-9]+/", + "'primary' => Color::".$adminPanelColor, + 'app/Providers/Filament/AdminPanelProvider.php' + ); + } + if ($skeletor->exists('README.md')) { $skeletor->removeFile('README.md'); }