public static randomColor ( ) : string | ||
Résultat | string | A random CSS color string. |
public static function randomColor()
{
$color = '#';
for ($i = 0; $i < 3; $i++) {
$color .= sprintf('%02x', mt_rand(0, 255));
}
return $color;
}
/** * Create the default calendar share for the current user. * * @return Horde_Share_Object The new default share. */ public function createDefaultShare() { $share = $this->_shares->newShare($this->_user, strval(new Horde_Support_Randomid()), $this->_getDefaultShareName()); $share->set('color', Kronolith::randomColor()); $this->_prepareDefaultShare($share); $this->_shares->addShare($share); return $share; }