Mail::SpamAssassin::HTML::Color(3) User Contributed Perl Documentation Mail::SpamAssassin::HTML::Color(3)

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

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

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.

Creates a new color object from a CSS color string.

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

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

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

Returns the color as an array of RGB values.

2025-12-13 perl v5.42.0