function test_HEX_to_RGB_exception()
 {
     $invalid_hex_color = ColorUtils::hex_rgb('violet');
     $this->assertEquals('Not a valid hex color.', $invalid_hex_color->getMessage());
     $invalid_color_format = ColorUtils::hex_rgb('1234567');
     $this->assertEquals('Not a valid color format.', $invalid_color_format->getMessage());
 }
 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;
     }
 }