Index: wp-content/themes/twentyeleven/functions.php
===================================================================
--- wp-content/themes/twentyeleven/functions.php	(revision 20649)
+++ wp-content/themes/twentyeleven/functions.php	(working copy)
@@ -586,3 +586,108 @@
 }
 add_filter( 'body_class', 'twentyeleven_body_classes' );
 
+
+function twentyeleven_customize_register($wp_customize) {
+	if ( !isset( $wp_customize ) )
+		return;
+
+	$wp_customize->get_setting('blogname')->transport='postMessage';
+	$wp_customize->get_setting('blogdescription')->transport='postMessage';
+	$wp_customize->get_setting('header_textcolor')->transport='postMessage';
+		
+	$wp_customize->add_section( 'twentyeleven_color_scheme', array(
+		'title'          => __( 'Color Scheme', 'twentyeleven' ),
+		'priority'       => 35,
+	) );
+	
+	$options = twentyeleven_get_theme_options();
+	$defaults = twentyeleven_get_default_theme_options(); 
+
+	$wp_customize->add_setting( 'twentyeleven_theme_options[color_scheme]', array(
+		'default'        => $defaults['color_scheme'],
+		'type'           => 'option',
+		'capability'     => 'edit_theme_options',
+	) );
+		
+	$schemes = twentyeleven_color_schemes();
+	$choices = array();
+	foreach ($schemes as $scheme) {
+		$choices[$scheme['value']] = $scheme['label'];
+	}
+	
+	$wp_customize->add_control( 'twentyeleven_color_scheme', array(
+		'label'      => __( 'Color Scheme', 'twentyeleven' ),
+		'section'    => 'twentyeleven_color_scheme',
+		'settings'   => 'twentyeleven_theme_options[color_scheme]',
+		'type'       => 'radio',
+		'choices'    => $choices,
+	) );
+
+	$wp_customize->add_setting( 'twentyeleven_theme_options[link_color]', array(
+		'default'        => twentyeleven_get_default_link_color($options['color_scheme']),
+		'type'           => 'option',
+		'sanitize_callback' => 'twentyeleven_sanitize_hexcolor',
+		'capability'     => 'edit_theme_options',
+	) );
+	
+	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
+		'label'   => __( 'Link Color', 'twentyeleven' ),
+		'section' => 'twentyeleven_color_scheme',
+		'settings'   => 'twentyeleven_theme_options[link_color]',
+	) ) );
+	
+	$wp_customize->add_section( 'twentyeleven_layout', array( 
+		'title'    => __( 'Default Layout', 'twentyeleven' ), 
+		'priority' => 40, 
+	) ); 
+
+	$wp_customize->add_setting( 'twentyeleven_theme_options[theme_layout]', array( 
+		'type'              => 'option', 
+		'default'           => $defaults['theme_layout'], 
+		'sanitize_callback' => 'sanitize_key', 
+	) ); 
+
+	$layouts = twentyeleven_layouts();
+	$choices = array();
+	foreach ($layouts as $layout) {
+		$choices[$layout['value']] = $layout['label'];
+	}
+	
+	$wp_customize->add_control( 'twentyeleven_theme_options[theme_layout]', array( 
+		'section'    => 'twentyeleven_layout', 
+		'type'       => 'radio', 
+		'choices'    => $choices,
+	) );
+	
+	if ( $wp_customize->is_preview() && ! is_admin() )
+		add_action( 'wp_footer', 'twentyeleven_customize_preview', 21);
+}
+add_action( 'customize_register', 'twentyeleven_customize_register' );
+
+
+function twentyeleven_sanitize_hexcolor($color) {
+	return '#'.sanitize_hexcolor($color);
+}
+
+
+function twentyeleven_customize_preview() {
+	?>
+	<script type="text/javascript">
+	wp.customize('blogname',function( value ) {
+		value.bind(function(to) {
+			jQuery('#site-title a').html(to);
+		});
+	});
+	wp.customize('blogdescription',function( value ) {
+		value.bind(function(to) {
+			jQuery('#site-description').html(to);
+		});
+	});
+	wp.customize( 'header_textcolor', function( value ) {
+		value.bind( function( to ) {
+			jQuery('#site-title a, #site-description').css('color', to ? '#' + to : '' );
+		});
+	});
+	</script>
+	<?php
+}
