Skip to content

Commit

Permalink
Add support for custom admin panel colors in setup
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWithDennis committed Dec 10, 2024
1 parent 2b53b26 commit dffcad4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Skeletorfile.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Filament\Support\Colors\Color;
use NiftyCo\Skeletor\Skeletor;

return function (Skeletor $skeletor) {
Expand All @@ -17,6 +18,15 @@
->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);
Expand Down Expand Up @@ -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');
}
Expand Down

0 comments on commit dffcad4

Please sign in to comment.