public static function sanitize_hex($color = '#FFFFFF', $hash = true) { if (!$hash) { return ltrim(self::sanitize_color($color, 'hex'), '#'); } return self::sanitize_color($color, 'hex'); }
/** * Returns an array properly formatted for use by the Kirki_Palette control. * * @param $palettes_nr int the number of palettes we want to get * @return array */ public static function get_palettes($palettes_nr = 5) { $palettes = self::parse(); $palettes = array_slice($palettes, 0, $palettes_nr); $i = 0; foreach ($palettes as $palette) { $palettes[$i] = array(); foreach ($palette as $key => $value) { $palettes[$i][$key] = Kirki_Color::sanitize_hex($value); } $i++; } return $palettes; }