+/**
+ * Regenerate the custom CSS file with provided settings.
+ *
+ * @param array $params Plugin configuration (CSS rules)
+ */
+function default_colors_generate_css_file($params): void
+{
+ $file = PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css';
+ $template = file_get_contents(PluginManager::$PLUGINS_PATH . '/default_colors/default_colors.css.template');
+ $content = '';
+ foreach (DEFAULT_COLORS_PLACEHOLDERS as $rule) {
+ $content .= !empty($params[$rule])
+ ? default_colors_format_css_rule($params, $rule) . ';' . PHP_EOL
+ : '';
+ }
+
+ if (! empty($content)) {
+ file_put_contents($file, sprintf($template, $content));
+ }
+}
+