/** * save given tag with random color * * @return void * @param string $tag */ public function autocolorTag($tag) { if (strlen(trim($tag)) == 0) { return; } // tag color allready defined if ($this->hasTag($tag)) { return; } // get unused random color while (true) { $color = \helpers\Color::randomColor(); if ($this->isColorUsed($color) === false) { break; } } $this->saveTagColor($tag, $color); }