another one. blog 1 remain unchanged, every other blog have a specific color<br><br><?php<br>/*<br>Plugin Name: Dynamic Site Colors<br>Plugin URI: <a href="http://www.mailpress.org">http://www.mailpress.org</a><br>Description: Dynamic admin header color for multiple sites<br>
Author: André RENAUT<br>Version: 0-dev<br>Author URI: <a href="http://www.mailpress.org">http://www.mailpress.org</a><br>*/<br><br>class Dynamic_Site_Colors<br>{<br> function __construct() {<br> $this->Dynamic_Site_Colors();<br>
}<br><br> function Dynamic_Site_Colors() {<br> add_action('admin_print_styles', array(&$this, 'admin_print_styles'));<br> }<br><br> function admin_print_styles() {<br> global $current_blog;<br>
<br> if (1 == $current_blog->blog_id) return;<br><br> $color = $this->get_color($current_blog->blog_id);<br>?><br> <!-- Dynamic_Site_Colors : <?php echo $site->id; ?> --><br> <style type='text/css'>#wphead {background:<?php echo $color; ?> !important;}</style><br>
<!-- Dynamic_Site_Colors --><br><?php<br> }<br><br> function get_color($p)<br> {<br> $x = pow(3,$p);<br> $y = intval($p/3) * 10;<br> $p = (355/113)* pow($p,2);<br> $c = '';<br>
$c = sprintf("%02X", $this->bc_mod($p, '255')) . sprintf("%02X", $this->bc_mod($y, '255')) . sprintf("%02X", $this->bc_mod($x, '255'));<br> return "#$c";<br>
}<br><br> function bc_mod( $x, $y )<br> {<br> // how many numbers to take at once? carefull not to exceed (int)<br> $take = 5;<br> $mod = '';<br> do<br> {<br> $a = (int)$mod.substr( $x, 0, $take );<br>
$x = substr( $x, $take );<br> $mod = $a % $y;<br> }<br> while ( strlen($x) );<br> return (int)$mod;<br> }<br>}<br>new Dynamic_Site_Colors();<br>