a, #access a:focus', 'background' ) ), __( 'Menu Hover' ) ); /** * Headings */ add_color_rule( 'txt', '#222222', array( // 3rd arg tells us bg to calculate contrast against. Use #hex or $cat // 4th (optional) arg tells us minimum contrast ratio to target. Defaults to 5, which may be more than needed in places. array( '.entry-title, .entry-title a, .singular .entry-title', 'color', '#fff', 2 ), array( '.entry-title a:hover, .entry-title a:focus', 'color', '-1' ), ) ); /** * Links * * Pull link color from TE options */ $options = get_option( 'twentyeleven_theme_options' ); $link_color = ( isset( $options['link_color'] ) ) ? $options['link_color'] : '#1b8be0'; add_color_rule( 'link', $link_color, array( // 3rd arg tells us bg to calculate contrast against. Use #hex or $cat array( 'a, #site-title a:focus, #site-title a:hover, #site-title a:active, .entry-title a:active, .widget_twentyeleven_ephemera .comments-link a:hover, section.recent-posts .other-recent-posts a[rel="bookmark"]:hover, section.recent-posts .other-recent-posts .comments-link a:hover, .format-image footer.entry-meta a:hover, #site-generator a:hover', 'color', '#fff' ), array( 'section.recent-posts .other-recent-posts .comments-link a:hover', 'border-color'), array( 'article.feature-image.small .entry-summary p a:hover, .entry-header .comments-link a:hover, .entry-header .comments-link a:focus, .entry-header .comments-link a:active, .feature-slider a.active', 'background-color' ) ) ); /** * Color rules with the 'extra' cat are used to set a permanent color. * Useful for transparency effects on elements that need to blend with user's colors */ add_color_rule( 'extra', '#000', array( array( '#branding .only-search #s', 'border-color', .2 ), array( '#site-generator', 'border-color', .1 ) ) ); add_color_rule( 'extra', '#fff', array( array( '#branding .only-search #s', 'background-color', .4 ), array( '#branding .only-search #s:focus', 'background-color', .9 ) ) ); /** * We can pass extra text color rules via 'extra' as below. * Note that we are using $cat for the 3rd rule args to calculate contrast against. */ add_color_rule( 'extra', '#eeeeee', array( array( '#access a', 'color', 'fg1' ) ) ); add_color_rule( 'extra', '#373737', array( array( '#access li:hover > a, #access a:focus', 'color', 'fg2' ), array( '#branding .only-search #s', 'color', 'fg2' ) ) ); add_theme_support( 'custom_colors_extra_css', 'twentyeleven_extra_css' ); function twentyeleven_extra_css() { ?> #access { background-image: -webkit-linear-gradient( rgba(0,0,0,0), rgba(0,0,0,0.08) ); background-image: -moz-linear-gradient( rgba(0,0,0,0), rgba(0,0,0,0.08) ); background-image: linear-gradient( rgba(0,0,0,0), rgba(0,0,0,0.08) ); box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 2px; }