Adsense widget is so easy to use and add ads on your wordpress blog. But there is one missing part. Colors?! Wrong. With adsense widget you can change colors in two different ways. Here i will show you how to change your ad colors for your theme.

First option is using Google‘s ad management feature called ad slots. While creating a new ad from Adsense creates an ad slot on your adsense panel. When you click on Manage ads you will see your previously generated codes.

Those are called slots. And each slot is editable after you create it. Slots allow you to edit ad format, colors, font, corner styles and channels anytime. So this is where you can pick your colors for your ads. When you specify slot id in your widget it automatically takes color data from adsense.

This option is recommended for users who can’t edit codes at all times. You can easily login to Google Adsense and change anything you need via Adsense Admin Panel.

(NOTE: Color changes sometimes take 5 to 10 minutes to appear.)

The second way to change colors is done via functions.php. Simply open functions.php in your theme folder and add the following lines:
[php title=”functions.php”]// Adsense Colors
update_option(‘shailan_adsense_colors’,
‘google_color_border = "222222"; // Border color
google_color_link = "B0D551"; // Link color
google_color_url = [ "444444", "555555" ];
google_color_text = [ "666666", "777777" ];
google_color_bg = "222222";’); // Background color

Plugin automatically checks for this option while outputting adsense script and if this option exists it uses it in the script code. Giving multiple colors in brackets will randomize colors. Google will pick a random color from the array of colors and display ad that way. You can try using various colors on your site to see which fits better.

You can change colors as needed. Those are all hexadecimal color values without a # before them. You can see a list of hex colors here. You should be careful about punctuation while using this method since a mistake will prevent your ads from being displayed on your site.

This second option is recommended for theme developers who want adsense colors to fit their themes. This way you will save your client from fighting colorpickers to find the right color.

As you can see i kept it quite simple. You just have to decide which one is better for your needs. The rest is done by Adsense Widget.