How to Change Colors in the Twenty Twelve Theme: A Complete CSS Guide
Content
Customizing the look of your WordPress site is a common task, and one of the most frequent requests from users of the classic Twenty Twelve theme is how to change its default colors. Whether you want to modify the background, text, or link colors, this guide will walk you through the most effective methods using CSS.
Why Can't I Just Change a Setting?
The Twenty Twelve theme, like many older WordPress themes, was built with a specific design in mind. Its color scheme is hardcoded into its stylesheet (style.css) and is not managed by a built-in color picker or theme options panel. This means that to make visual changes, you must override the default CSS rules.
The Golden Rule: Use a Child Theme
Before you change a single line of code, the most important step is to use a child theme. As seen in numerous support threads, directly editing the theme's files is a recipe for disaster. The next time Twenty Twelve receives an update, all of your customizations will be erased. A child theme protects your changes and is the universally recommended best practice.
Common Color Changes and Their Solutions
1. Changing the Default Text Color
The default body text in Twenty Twelve is a dark gray (#444). To change it globally to black, add the following CSS to your child theme's style.css file or the Additional CSS panel in the Customizer (Appearance > Customize).
body {
color: #000000;
}
2. Changing Link Colors
Links are more complex because they have multiple states: unvisited (:link), visited (:visited), hover (:hover), and active (:active). The default link color is blue (#21759b). To comprehensively change link colors site-wide, use this template:
/* Change all unvisited links */
a:link {
color: #21759b;
}
/* Change all visited links */
a:visited {
color: #696969;
}
/* Change link color on hover */
a:hover {
color: #b5b5b5;
}
/* Change link color the moment it is clicked */
a:active {
color: #b5b5b5;
}
Important Note: For visited link colors to work correctly, they must be defined after the :link pseudo-class. The order of these CSS rules is crucial.
3. Changing the Background Color of a Single Page
WordPress adds unique classes to the body tag of every page, allowing for highly specific styling. For example, to change the background of just one page, first identify its page ID (e.g., page-id-686). Then, use this CSS:
body.page-id-686 {
background-color: #FBF4E1 !important;
}
4. Changing the Footer or Sidebar Background
To change the background of the entire footer widget area, target the .widget-area class. To add padding after applying a background, include that property as well.
.widget-area {
background-color: #E5E4E4;
padding: 20px; /* Adds space around the widgets */
}
5. Changing Page and Post Title Colors
To change the color of titles for both pages and posts, target the .entry-title class.
.entry-title, .entry-title a {
color: #dd9933 !important;
}
Troubleshooting Common Issues
- Why aren't my changes working? The most common cause is CSS specificity. The theme's original rule might be more specific than your new one. Use your browser's Inspect Element tool to identify the exact CSS rule you need to override. Sometimes, adding
!important(as shown above) can force your style to take precedence, but use this declaration sparingly. - My visited link color won't change! Browser security restrictions can sometimes limit how the :visited pseudo-class is styled. Ensure your rule is placed after any :link rules and that you are not trying to change properties other than color.
- My changes disappeared after an update! This confirms you were editing the parent theme's files directly. You must switch to a child theme to make permanent changes.
By understanding these core CSS concepts, you can take full control over the color scheme of your Twenty Twelve theme and create a site that matches your unique branding.
Related Support Threads Support
-
Adding Link effect to comments and postshttps://wordpress.org/support/topic/adding-link-effect-to-comments-and-posts/
-
Changing Font Colorshttps://wordpress.org/support/topic/changing-font-colors-1/
-
Changing background colors in sidebar areahttps://wordpress.org/support/topic/changing-background-colors-in-sidebar-area/
-
BLACK TEXThttps://wordpress.org/support/topic/black-text-2/
-
changing link colors in twenty twelvehttps://wordpress.org/support/topic/changing-link-colors-in-twenty-twelve/
-
Changing links colour in twenty twelvehttps://wordpress.org/support/topic/changing-links-colour-in-twenty-twelve/
-
Can't change visited link colorhttps://wordpress.org/support/topic/cant-change-visited-link-color/
-
Change color of links in posts and pages only csshttps://wordpress.org/support/topic/change-color-of-links-in-posts-and-pages-only-css/
-
Different Color for Blog Backgroundhttps://wordpress.org/support/topic/different-color-for-blog-background/
-
2012 link issuehttps://wordpress.org/support/topic/2012-link-issue/
-
Use a different color for "post teaser list/posts" and "sidebar"https://wordpress.org/support/topic/use-a-different-color-for-post-teaser-listposts-and-sidebar/
-
Search field in Mobile themehttps://wordpress.org/support/topic/search-field-in-mobile-theme/
-
[Twenty Twelve] How to change background color of navigation?https://wordpress.org/support/topic/twenty-twelve-how-to-change-background-color-of-navigation-1/
-
How to remove link underline?https://wordpress.org/support/topic/how-to-remove-link-underline/
-
[Theme: Twenty Twelve] Make the whole page one color. (One page site)https://wordpress.org/support/topic/theme-twenty-twelve-make-the-whole-page-one-color-one-page-site/
-
How to Customize the Button in Product By Category Elementhttps://wordpress.org/support/topic/how-to-customize-the-button-in-product-by-category-element-2/
-
Need help with Visited link CSShttps://wordpress.org/support/topic/need-help-with-visited-link-css/
-
Changing default font color for links and page titleshttps://wordpress.org/support/topic/changing-default-font-color-for-links-and-page-titles/
-
BG color to sidebarhttps://wordpress.org/support/topic/bg-color-to-sidebar/
-
Text on home page looks greyed outhttps://wordpress.org/support/topic/text-on-home-page-looks-greyed-out/
-
changing font and colourhttps://wordpress.org/support/topic/changing-font-and-colour/
-
Visited Link Color Does Not Change per CSShttps://wordpress.org/support/topic/visited-link-color-does-not-change-per-css/
-
Change text color for name of pageshttps://wordpress.org/support/topic/change-text-color-for-name-of-pages/
-
custom color text option missinghttps://wordpress.org/support/topic/custom-color-text-option-missing-2/
-
Change Font Color?https://wordpress.org/support/topic/change-font-color-67/
-
css visited link colour and hover over visited link colour won't change.https://wordpress.org/support/topic/css-visited-link-colour-and-hover-over-visited-link-colour-wont-change/
-
Changing The Default Text Colourhttps://wordpress.org/support/topic/changing-the-default-text-colour/
-
footer background colorhttps://wordpress.org/support/topic/footer-background-color-1/
-
Change Link Color in Twenty Twelvehttps://wordpress.org/support/topic/change-link-color-in-twenty-twelve/
-
Asides Post Formathttps://wordpress.org/support/topic/asides-post-format/
-
Changing colour of post header titleshttps://wordpress.org/support/topic/changing-colour-of-post-header-titles/
-
Change wrapper colorhttps://wordpress.org/support/topic/change-wrapper-color/
-
Styles.css after updating will not changehttps://wordpress.org/support/topic/styles-css-after-updating-will-not-change/
-
Color issueshttps://wordpress.org/support/topic/color-issues-2/
-
hyperlinkshttps://wordpress.org/support/topic/hyperlinks-12/
-
css category descriptionhttps://wordpress.org/support/topic/css-category-description/
-
Twenty Twelve Change single page colorhttps://wordpress.org/support/topic/twenty-twelve-change-single-page-color/
-
How do I change background color for sidebar on Twenty Twelve themehttps://wordpress.org/support/topic/how-do-i-change-background-color-for-sidebar-on-twenty-twelve-theme/
-
Background Hover Color on Mobile Deviceshttps://wordpress.org/support/topic/background-hover-color-on-mobile-devices/
-
How do I change the color of my links?https://wordpress.org/support/topic/how-do-i-change-the-color-of-my-links/
-
Change text-color in mail-form and feedback-formhttps://wordpress.org/support/topic/change-text-color-in-mail-form-and-feedback-form/