{"id":139,"date":"2015-10-08T00:27:16","date_gmt":"2015-10-08T00:27:16","guid":{"rendered":"https:\/\/themetry.com\/?p=139"},"modified":"2017-06-16T14:46:24","modified_gmt":"2017-06-16T14:46:24","slug":"adaline-accent-color","status":"publish","type":"post","link":"https:\/\/themetry.com\/adaline-accent-color\/","title":{"rendered":"Customizing Adaline’s accent color"},"content":{"rendered":"
<\/p>\n
Adaline<\/a> is a very yellow theme. You may want to change that yellow to a different color.<\/p>\n In this tutorial, we’ll create an Adaline child theme to do just that.<\/p>\n tl;dr: You can find the Adaline accent color child theme files on GitHub<\/a>. Modify to your color of choice and install.<\/p>\n <\/p>\n The first step is to get the basic child theme structure squared away. Let’s reference the WordPress.org documentation on child theme creation<\/a> to do this.<\/p>\n In your In that currently empty directory, let’s add two files:<\/p>\n The first thing we’re going to do is set the header in our new child theme’s style.css file.<\/p>\n <\/code><\/p>\n This allows WordPress to recognize that this is a child theme of Adaline (set with the “Template: adaline” line).<\/p>\n After activating though, you’ll notice that the theme is almost completely styleless.<\/p>\n Let’s fix that.<\/p>\n We’ll use functions.php to grab the parent theme’s stylesheet.<\/p>\n If you’re super concerned about minimizing HTTP requests (which you shouldn’t be if you use HTTP\/2, but we’ll get into that another time), you may want to copy and paste Adaline’s CSS code into your new child theme’s stylesheet.<\/p>\n Never<\/em> use CSS @import<\/a>.<\/p>\n Because we don’t like repeating ourselves, we’ll use our child theme’s Here’s what our functions.php file contains.<\/p>\n <\/code><\/p>\n With an opening <?php tag, of course. Note that the child theme’s CSS is already there since get_stylesheet_uri() enqueued in the parent theme.<\/p>\n We won’t touch functions.php for the rest of the tutorial. Time to add some pizzazz.<\/p>\n Adaline’s accent color applies to three things: background colors, font colors, and border colors. To create an accent color child theme, we’ll have to comb through the stylesheet and pick out the relevant CSS selectors.<\/p>\n To do this, we’re just going to do a text search for any mentions of the three yellow hex codes used (#ffff00, #ffef08 and #fe0) and take note of what CSS attribute it’s applied to (background, color, or border).<\/p>\n While the shades of yellow are slightly different, we’re going to be changing them all to the same color, so let’s group each selector by attribute.<\/p>\n <\/code><\/p>\n <\/code><\/p>\n <\/code><\/p>\n Now let’s change ’em all to…pink! As in, literally just the word “pink” replacing all the yellow hex codes.<\/p>\n We’ll use color-specific CSS attributes to override the CSS shorthand used in some of the selectors, since we just are about color here (for example, We end up with this:<\/p>\n <\/code><\/p>\n If you didn’t peek already from the GitHub link above, take a look at the finalized style.css<\/a> and functions.php<\/a> on GitHub, just to make sure we’re on the same page.<\/p>\n If you want to keep the pink accent color, feel free to grab this screenshot<\/a> as well.<\/p>\n","protected":false},"excerpt":{"rendered":" Adaline is a very yellow theme. In this tutorial, we’ll create an Adaline child theme to change the accent color to pink.<\/p>\n","protected":false},"author":1,"featured_media":349,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"acf":[],"yoast_head":"\nChild theme structure<\/h2>\n
\/wp-content\/themes\/<\/code> folder, create an empty directory. We’ll call ours
adaline-pink<\/code>.<\/p>\n
\n
The style.css header<\/h2>\n
<\/p>\n
\/*\r\n Theme Name: Adaline Pink\r\n Theme URI: https:\/\/themetry.com\/adaline-accent-color\/\r\n Description: This is a child theme of Themetry's Adaline theme, used to demonstrate changing the accent color.\r\n Author: Themetry\r\n Author URI: https:\/\/themetry.com\r\n Template: adaline\r\n Version: 1.0.0\r\n License: GNU General Public License v2 or later\r\n License URI: http:\/\/www.gnu.org\/licenses\/gpl-2.0.html\r\n Text Domain: adaline-pink\r\n*\/<\/pre>\n
What goes in functions.php<\/h2>\n
functions.php<\/code> file to enqueue the parent theme’s stylesheet.<\/p>\n
<\/p>\n
function adaline_pink_enqueue_styles() {\r\n\twp_enqueue_style( 'parent-style', get_template_directory_uri() . '\/style.css' );\r\n}\r\nadd_action( 'wp_enqueue_scripts', 'adaline_pink_enqueue_styles' );\r\n<\/pre>\n
Abstract the color CSS<\/h2>\n
background-color<\/h3>\n
<\/p>\n
.site-header,\r\n.single .entry-title:before,\r\n.comment-reply-title<\/pre>\n
color<\/h3>\n
<\/p>\n
.site-header > .logo-letter<\/pre>\n
border-color<\/h3>\n
<\/p>\n
.posts-navigation a,\r\n.site-main #infinite-handle span button,\r\n.site-main #infinite-handle span button:hover,\r\n.site-main #infinite-handle span button:focus,\r\n.posts-navigation a:before,\r\n#infinite-handle button:before,\r\n.main-navigation a,\r\n.byline a,\r\n.cat-links a,\r\n.entry-content a,\r\n.featured-primary .entry-excerpt a,\r\n.post-navigation .nav-links a,\r\n.comment-navigation a,\r\n.comment-content a,\r\n.comment-form a,\r\n.widget a,\r\n.site-info-text a,\r\n.featured-row<\/pre>\n
border-color: pink<\/code> instead of
border-bottom: 1px solid pink;<\/code>)<\/p>\n
<\/p>\n
.site-header,\r\n.single .entry-title:before,\r\n.comment-reply-title {\r\n\tbackground-color: pink;\r\n}\r\n\r\n.site-header > .logo-letter { \r\n\tcolor: pink;\r\n}\r\n\r\n.posts-navigation a,\r\n.site-main #infinite-handle span button,\r\n.site-main #infinite-handle span button:hover,\r\n.site-main #infinite-handle span button:focus,\r\n.posts-navigation a:before,\r\n#infinite-handle button:before,\r\n.main-navigation a,\r\n.byline a,\r\n.cat-links a,\r\n.entry-content a,\r\n.featured-primary .entry-excerpt a,\r\n.post-navigation .nav-links a,\r\n.comment-navigation a,\r\n.comment-content a,\r\n.comment-form a,\r\n.widget a,\r\n.site-info-text a,\r\n.featured-row {\r\n\tborder-color: pink;\r\n}<\/pre>\n