vagrant / snapToMaterial / 0.1.0

The Algorithm

This is an O(n^2) algorithm that maps RGB or HEX color values to a discretized Material Design color palette.

 Featured above is a mapping from a randomly generated color value to the closest color on the material design color pallet.

Representation of Colors [Input]

The algorithm takes, as input, an array of color values.  

The input may be expressed in an RGB or HEX triplet format.  Either RGB, HEX triplet, or BOTH can be provided as an item of this array.  If both RGB and HEX values are provided to describe a single color, then the algorithm processes the RGB value.  

The following Snippet expresses flexibility in input representation. 

Representation of Colors [Output]

The algorithm outputs an array of Colors.  
The colors are expressed in both RGB and HEX format.   

Objects in the array are sequentially ordered to reflect input order.    

Batch Size

A single call to this algorithm checks a batch size of up to 100 colors. In the event that more than 100 colors are provided, only the first 100 will be processed, the rest will be returned as a list of unprocessed objects.