<?php

class Orphic_Wp_Block_Option_Script {

  //create function static to create a file css and write the css variable
  public static function create_css_file_custom($colors, $file_slug = 'custom') {
    $css = 'html {' . PHP_EOL;
    foreach ($colors as $color) {
      $css .= '  --orphic-wp-block-plugin-color-' . $color['slug'] . ' : ' . $color['color'] . ';' . PHP_EOL;
    }
    $css .= '}';
    //create a file css
    $file = fopen(ORPHIC_PLUGIN_UI_DIR_PATH . 'public/css/orphic-wp-block-plugin-' . $file_slug . '.css', 'w');
    //write the css variable
    fwrite($file, $css);
    fclose($file);
    //add the css file to the plugin
  }

  public static function create_css_file_default() {
    $default_colors = Orphic_UI_Public::DEFAULT_COLORS;
    self::create_css_file_custom($default_colors, 'classic');
  }
}
