Help language development. Donate to The Perl Foundation

Color::Named cpan:HOLLI last updated on 2017-10-20

Color::Named - Work with named colors


    use Color::Named;        # load the X11 color set
    use Color::Named <X11>;  # same
    use Color::Named <XKCD>; # load the XKCD color set

    # these are all identical
    my $color = :name<antiquewhite> );
    my $color = :name<antique white> );
    my $color = :name<Antique White> );

    say "Bazinga!" if $color ~~ Color;
    say $;        #antiquewhite
    say $color.pretty-name; #Antique White


`Color::Named` is a subclass of `Color`. It adds a new constructor to which you can pass the name of a color. The name must be defined in your chosen color set.

You can choose from (currently) three color sets: X11, CSS3 and the xkcd set from the [xkcd color survey](

The X11 and CSS3 sets are basically [identical](, except for 4 colors.


Other than `Color` objects, instances of `Color::Named` stringify to the pretty name (with spaces, title cased) of the color.


    Markus «Holli» Holzer


Copyright © Markus Holzer ( [email protected] )

License GPLv3: The GNU General Public License, Version 3, 29 June 2007 <>

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.