I refer to this post
change $site to $newSite.
looks very good.
'hooks' => [
'site.update:after' => function ($newSite) {
$css = ':root {
--primary-color: ' . $newSite->primaryColor()->value() . ';
--secondry-color: ' . $newSite->secondryColor()->value() . ';
}';
F::write(kirby()->root('assets') . '/css/custom.css', $css);
}
],