ColorPicker::make('background')
->label('Background Color')
->colors($this->getBackgroundColors())
->live()
->extraAttributes(['id' => 'background'])
->afterStateUpdated(function ($livewire) {
$colors = json_encode($this->getBackgroundColors());
$livewire->js(
<<<JS
const colors = JSON.parse('$colors');
const color = document.querySelector('#background input[type="radio"]:checked').value;
const shades = colors[color];
previewTheme('gray', shades);
window.background = shades;
updateTheme();
JS
);
}),
ColorPicker::make('background')
->label('Background Color')
->colors($this->getBackgroundColors())
->live()
->extraAttributes(['id' => 'background'])
->afterStateUpdated(function ($livewire) {
$colors = json_encode($this->getBackgroundColors());
$livewire->js(
<<<JS
const colors = JSON.parse('$colors');
const color = document.querySelector('#background input[type="radio"]:checked').value;
const shades = colors[color];
previewTheme('gray', shades);
window.background = shades;
updateTheme();
JS
);
}),