LEGO::Colors - Access to LEGO color information.


 use LEGO::Color;
 use strict;

 my $green = LEGO::Color->new(
   name  => 'green',
   red   => 0,
   green => 255,
   blue  => 0,

 # Or, more likely...
 my $green = LEGO::Colors->get_color('green');


This is a simple accessor class, used to store information about various different colors that LEGO pieces can have. Generally, you won't be creating these yourself -- they're just convenient ways to pass information back from the LEGO::Colors module. Please see that documentation for more information.



Constructs a new Color object. Takes 4 named parameters, all required. They are: name, red, blue and green, and hopefully self-explanatory. Returns undef if any parameters are missing or invalid.


Returns the name of this color object.


Returns the red value of this color object.


Returns the blue value of this color object.


Returns the green value of this color object.


A convenience method that returns all 3 red, green and blue values in a single hashref.


Returns an HTML color code, of the form "#XXYYZZ" that represents the RGB values of this color object.

Future Work

  • None at this time.

Known Issues

  • None at this time.


Copyright 2007 Avi Finkel <>

This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the terms of the Perl Artistic License (see

LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this software. The official LEGO website is at

1 POD Error

The following errors were encountered while parsing the POD:

Around line 178:

Non-ASCII character seen before =encoding in 'LEGO®'. Assuming CP1252