<?php global $ci, $ci_defaults, $load_defaults; ?>
<?php if ( true === $load_defaults ) : ?>
<?php

	$ci_defaults['stylesheet'] = apply_filters( 'ci_theme_panel_default_stylesheet', 'default.css' );

	add_filter( 'ci_theme_sanitize_panel_options', 'ci_theme_panel_sanitize_snippet_color_scheme', 10, 2 );
	function ci_theme_panel_sanitize_snippet_color_scheme( $values, $defaults ) {
		$values['stylesheet'] = sanitize_text_field( $values['stylesheet'] );

		return $values;
	}
?>
<?php else : ?>

	<fieldset id="ci-panel-color-scheme" class="set">
		<legend><?php esc_html_e( 'Color Scheme', 'ci_theme' ); ?></legend>
		<p class="guide"><?php esc_html_e( 'Select your color scheme. This affects the overall look and feel of your website.', 'ci_theme' ); ?></p>
		<?php
			// Try to retain old settings where the stylesheet didn't include the extension .css
			if ( ! empty( $ci['stylesheet'] ) ) {
				$color = $ci['stylesheet'];
				if ( substr_right( $ci['stylesheet'], 4 ) !== '.css' ) {
					$ci['stylesheet'] = $ci['stylesheet'] . '.css';
				}
			}

			ci_panel_dropdown( 'stylesheet', ci_pcsc_get_color_schemes(), __( 'Color scheme', 'ci_theme' ) );
		?>
	</fieldset>

<?php endif;
