'ffffff', 'text' => '000000', 'link' => '52759a' ); $content_width = 500; if ( ! function_exists('get_option') ) die("This isn't what you're looking for. Try this."); function get_toni_colors() { return array( 'Blue' => '', 'Gray' => 'gray', 'Green' => 'green', 'Purple' => 'purple'); } function get_toni_color() { $toni_color = get_option('toni_color'); return clean_toni_color($toni_color); } function toni_color_select() { echo "\n"; } function toni_color_radios() { $colors = get_toni_colors(); $current_color = get_toni_color(); $theme_uri = get_template_directory_uri(); $i = 0; foreach ( $colors as $name => $value ) { $checked = ($current_color == $value) ? " checked='checked'" : ''; $filename = "preview{$value}.jpg"; echo "\n"; ++$i; } } function clean_toni_color($toni_color) { $toni_colors = get_toni_colors(); if ( in_array($toni_color, $toni_colors) ) return $toni_color; else return ''; } function toni_color() { echo get_toni_color(); } function toni_css() { $toni_color = get_toni_color(); $url = get_bloginfo('stylesheet_url'); if ( !empty($toni_color) ) $url = str_replace('style.css', "style_{$toni_color}.css", $url); $url = apply_filters('bloginfo', $url, 'stylesheet_url'); $url = convert_chars($url); echo $url; } add_action('admin_menu', 'toni_add_theme_page'); function toni_add_theme_page() { global $toni_message; if ( isset($_POST['action']) && 'toni_update' == $_POST['action'] ) { $color = clean_toni_color($_POST['toni_color']); update_option('toni_color', $color); $colors = array_flip(get_toni_colors()); $Color = __($colors[$color]); $message = sprintf(__("Color changed to %s"), $Color); $toni_message = "

$message

"; } add_theme_page("Toni Color", "Color Selection", 'edit_themes', basename(__FILE__), 'toni_theme_page'); } function toni_theme_page() { global $toni_message; echo $toni_message; ?>

Select a Color