NAME

Sew:Color - rgb colours for various manufactures of coloured embroidery thread.   

ABSTRACT

Module for determining rgb colours of various manufacturers of embroidering thread 
and the codes that go with them. 

SYNOPSIS

use Sew::Color
my @rgb=rgb('Brother', '502'); 
my $name=name('Brother','502'); 

print "$name (@rgb)\n"; 

DESCRIPTION

 These calls return respectively the red green and blue components of the colour of the thread 
 and the 'English' name of the thread colour. The colour components will be in the range 0 to 255. 
 In this case, Brother thread number 502. 
 Be aware that the name of the thread colour is not unique, there are some codes that have 
 the same name, although they are mostly different. 

 The above code prints out 
    
    Mint Green (148 190 140) 

 code(Manufacturer,red,green.blue)

 This function does a simple search in the colour space to find the colour that is closest to the rgb values you provide. 

 The parameters are

   Manufacturer: Can be a single manufacturer, a comma seperated list or an array reference of manufacturers. 
   				 It can be empty to search all known about. 
   red, green, blue are the colour co-ordinates to search for. Distnce is done through a very simple sequential search
                 using a simple 3-d colour model without any weightings. (so rgb all treated the same.) 

 The return values are: 

	In a scalar context, just the code, for example '502'. 
	In an array context it returns a 3 element array, with the following entries

		Manufacturer, eg 'Brother' 
		Thread code, eg '502'
		Error distance, eg 42. This is the distance in linear units scaled to 255 
		between the thread found and the desired colour. Note that it can be more than 255
		(Consider that the diagonal of a cube with side 255 is more than 255. ) but will normally 
		not be. 

Custom Searches

If you only have certain threads that you want to search (you dont happen to have the full Madeira
in your store cupboard!) you can say which ones you do have by using the custom function. This is called as follows

  custom('Manufacturer',list of codes, 'Manufacturer', list of codes ) 

A call to the code function with the special string 'custom' as manufacturer will search only these threads. 

  custom() 

will reset all the custom threads. 

Methods

rgb(Manufacturer, code) returns a 255-max scaled rgb tripplet. 
name(Manufacturer,code) returns the "English" name of the colour. 
code(Manufacturer-list,r,g,b)  returns either the code or an array 
						with the following: (Manufacturer,code,error distance) 

AUTHOR

Mark Winder June 2012. 
markwin (at) cpan.org