Kronolith::randomColor PHP Méthode

randomColor() public static méthode

Returns a random CSS color.
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;
    }

Usage Example

Exemple #1
0
 /**
  * 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;
 }
All Usage Examples Of Kronolith::randomColor