PHP code example of awcodes / palette
1. Go to this page and download the library: Download awcodes/palette library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
awcodes / palette example snippets
protected $casts = [
'content' => 'array', // or 'json'
];
[
'key' => 'primary',
'property' => '--primary-500',
'label' => 'Primary',
'type' => 'rgb',
'value' => '238, 246, 213',
]
use Awcodes\Palette\Forms\Components\ColorPicker;
use Filament\Support\Colors\Color;
ColorPicker::make('color')
->storeAsKey(),
use Awcodes\Palette\Forms\Components\ColorPicker;
use Filament\Support\Colors\Color;
ColorPicker::make('color')
->colors([
'indigo' => Color::Indigo
'badass' => Color::hex('#bada55'),
'salmon' => '#fa8072',
'bg-gradient-secondary' => 'bg-gradient-secondary'
])
->shades([
'badass' => 300
])
->size('sm') // optional 'xs', 'sm', 'md', 'lg', 'xl'
->withBlack(swap: '#111111')
->withWhite(swap: '#f5f5f5'),
use Awcodes\Palette\Forms\Components\ColorPickerSelect;
use Filament\Support\Colors\Color;
ColorPickerSelect::make('color')
->colors([
'indigo' => Color::Indigo
'badass' => Color::hex('#bada55'),
'salmon' => '#fa8072',
'bg-gradient-secondary' => 'bg-gradient-secondary'
])
->shades([
'badass' => 300
])
->withBlack(swap: '#111111')
->withWhite(swap: '#f5f5f5'),
use Awcodes\Palette\Infolists\Components\ColorEntry;
ColorEntry::make('color')
->size('sm') // optional 'xs', 'sm', 'md', 'lg', 'xl'
js
content: [
'./vendor/awcodes/palette/resources/views/**/*.blade.php',
]
bash
php artisan vendor:publish --tag="palette-config"