WordPress 2.5 introduces a neat option: per user Admin Color Scheme. This means that each user can select a stylesheet they like best for the whole admin area. Now onto the fun stuff: adding a per-user selectable custom stylesheet for your blog.

Concept
The new function behind this feature is wp_admin_css_color(), which is used as following:
-
wp_admin_css_color(
-
$shortname, // eg 'mycoolstyle', used to store setting in the wp_options table
-
$longname, // eg 'My Cool Style'
-
$css_url, // URL to your custom stylesheet
-
array(
-
$color_code_1, // a HTML color code like '#123456'
-
$color_code_2, // or 'red'
-
$color_code_3, // or 'rgb(100,100,100)'
-
... // any number of color codes you want
-
)
-
);
This function call populates an array ($_wp_admin_css_colors) which is then used on the profile page to display the cute colorful little table cells. In your plugins, hook the function call into 'admin_init', and you're done.
Example
Say you're a Brazil fan and you want to make a plugin that adds some sunshine into your admin area. You would create a custom stylesheet that would reside into your plugin directory, and the plugin itself would be something like:
-
<?php
-
/*
-
Plugin Name: Admin Custom CSS: Brazil!
-
Plugin URI: http://planetozh.com/blog/
-
Description: Plugin example: add a per-user custom CSS to the admin area
-
Author: Ozh
-
Version: 0.1
-
Author URI: http://planetozh.com/
-
*/
-
-
add_action('admin_init','custom_admin_css_brazil');
-
-
function custom_admin_css_brazil() {
-
$plugin_url = get_option( 'siteurl' ) . '/wp-content/plugins/' . plugin_basename(dirname(__FILE__)) ;
-
wp_admin_css_color(
-
'brazil',
-
__('Brazil'),
-
$plugin_url . '/wp-admin-brazil.css',
-
array(
-
'#3c940c',
-
'#fffc01',
-
'#3005eb',
-
)
-
);
-
}
-
?>
Real example for the not-so-DIYers : I made this quick plugin and its very quick stylesheet (be warned, the visual result is rather ugly): Plugin Example: Custom Admin CSS.

Note the cool CSS little trick in the options form :)
Pages: « 1 [2] Show All
pingback on 14/Apr/08 at 1:59 am # :
[...] ????WordPress 2.5 ????????????????????????????????????????????????????????????????????????? WordPress ??????????????????????????????? Fluency???????????????????????????? [...]
replied, on 15/Apr/08 at 4:28 pm # :
You know what would be really sick? A random colour generator. It could even change the colour on every page load! :)
replied, on 15/Apr/08 at 7:52 pm # :
Donncha O Caoimh » Heh, actually Donncha I'm close to doing this, and guess what, it won't even be ugly. Details some day :)
pingback on 16/Apr/08 at 2:07 am # :
[...] How-to add Per User Custom Stylesheet in WordPress 2.5 by Ozh. [...]
thought, on 16/Apr/08 at 5:33 pm # :
I think it would be cool to have something that pulled data from Adobe Kuler. That way people could just switch styles from there.
pingback on 19/Apr/08 at 2:07 pm # :
[...] many users, not me though. Not to worry, the old color scheme is an alternative or if you want to set your own colors, Planetozh has a guide as to how you can do just that via a [...]
pingback on 20/Apr/08 at 11:26 pm # :
[...] fue uno de los primeros cambios de lo que me enteré se venian con wordpress gracias a Ozh, se trata del Admin Color Scheme, por defecto wordpress sólo cuenta con 2 [...]
thought, on 29/Apr/08 at 8:04 pm # :
Hey, I did one! It's a super-minimal monochrome version. Thanks for the tip.
pingback on 01/May/08 at 5:51 pm # :
[...] ????? ?????? ????????? ?? ??? ???? ???? ? ???, ??? ????????? ????? ?????????? ?????? ? ????. ?? ?????? ?????????? ???????? ??????? wp_admin_css_color();. ????? ????????? ????? ?????????? ??????, ? ????? ? ? ??????? ???????. ? ??????? ???????????? ?????????? ????? ???????? ?????. ????? ?????? ? ?????? Per User Custom Stylesheet in WordPress 2.5 [...]
wrote, on 03/May/08 at 9:57 am # :
the good code, love Wp :)
pingback on 13/May/08 at 12:15 am # :
[...] months ago, I wrote an article about per-user admin color schemes that WordPress 2.5 brought in its bag of new features. A few days laters, I received an email from [...]
pingback on 23/May/08 at 2:07 pm # :
[...] Per User Custom Stylesheet in WordPress 2.5 [...]
pingback on 29/Jun/08 at 3:15 pm # :
[...] queres saber como editar ou criar as tuas próprias cores aconselho-te a ler este tutorial em inglês mas que é bastante [...]
pingback on 10/Jul/08 at 3:43 pm # :
[...] qui est très peut, mais Ozh a réaliser discrètement un petit script vous permettant de modifier les couleurs par défaut. Cela se fait via un fichier CSS modifiable, [...]
pingback on 26/Jul/08 at 10:45 pm # :
[...] Ozh describes how to create your own wp-admin stylesheet. //OBSTART:do_NOT_remove_this_comment var [...]
wrote, on 30/Jul/08 at 12:29 pm # :
wooow nice post. I tried to submit this to digg, but I keep getting the following error on Digg: "This link does not appear to be a working link. Please check the URL and try again." :/
thought, on 26/Sep/08 at 3:09 pm # :
wooow nice post. I tried to submit this to digg, but I keep getting the following error on Digg: "This link does not appear to be a working link. Please check the URL and try again."
Thanks you
said, on 04/Oct/08 at 2:48 pm # :
Replica watches,Siwss watches,Japan watches,Rolex watches,Omega,Gucci,Louis Vuitton,watches,Breitling,Vacheron Constantin,Chanel,Cartier,Bvlgari,Jacob & Co,Chopard,D&G watches Alain Silberstein,A Lange & Sohne,Porsche Design Watches,Mont Blanc,Patek Philippe,TAG Heuer,Jaeger,LeCoultre,pretty watches,high quality watches,fake watches
http://onestoptown.com