function setup() { $this->green = ColorUtils::rgb_rgbarr(127, 255, 64); $this->green_hex = ColorUtils::rgb_hex($this->green); $this->green_hsv = ColorUtils::rgb_hsv($this->green); $this->green_from_hsv = ColorUtils::hsv_rgb($this->green_hsv); $this->orange = ColorUtils::hex_rgb('#ed691f'); $this->cyan = ColorUtils::hex_rgb('8bc'); $this->red = ColorUtils::hex_rgb('f0'); }
private function get_color($comment_date, $newest_color = '#444444', $fade_out = TRUE) { if ($fade_out) { $time_span = ($_SERVER['REQUEST_TIME'] - $comment_date) / $this->range_in_seconds; $time_span = min($time_span, 1); $newest_color = ColorUtils::hex_rgb($newest_color); $color = array('r' => self::sanitize_color($newest_color['r'] + $this->color_diff['r'] * $time_span), 'g' => self::sanitize_color($newest_color['g'] + $this->color_diff['g'] * $time_span), 'b' => self::sanitize_color($newest_color['b'] + $this->color_diff['b'] * $time_span)); return '#' . ColorUtils::rgb_hex($color); } else { return $newest_color; } }