---
name: "Mail::SpamAssassin::HTML::Color"
section: "3pm"
platform: "linux"
package: "spamassassin"
version: "4.0.2-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Mail::SpamAssassin::HTML::Color"
---

# Mail::SpamAssassin::HTML::Color(3pm)

A class to parse and manipulate CSS color values

## NAME

Mail::SpamAssassin::HTML::Color - A class to parse and manipulate CSS color values

## SYNOPSIS

```
  use Mail::SpamAssassin::HTML::Color;
  my $color = Mail::SpamAssassin::HTML::Color->new('rgba(255, 0, 153, 0.5)');
  $color->blend([255, 255, 255]);
  my $distance = $color->distance([0, 0, 0]);
  print "$color";  # Outputs the color as a hex string
```

## DESCRIPTION

This class provides methods to parse various CSS color formats, blend them with a background color, calculate the distance between two colors, and convert the color to a hex string.

## METHODS

### new($color)

Creates a new color object from a CSS color string.

### blend($background)

Blends the color with the given background color. Modifies the color in-place and returns the modified object.

### distance($other\_color)

Calculates the distance between the current color and another color using a brightness-weighted geometric formula.

### as\_hex

Returns the color as a hex string with a leading '#'.

### as\_array

Returns the color as an array of RGB values.
