Skip to content

Instantly share code, notes, and snippets.

@jafish
Created September 25, 2009 05:32
Show Gist options
  • Save jafish/193344 to your computer and use it in GitHub Desktop.
Save jafish/193344 to your computer and use it in GitHub Desktop.
// A basic sketch of a class to parse and manage/hold color schemes
// from Adobe's Kuler (or any other list of hex value formatted colors)
// starting with a string of comma-separate hex color values
class Kuler
{
String colors = ""; // Put the sequence of comma-separated Kuler hex values here
String[] colorList;
int[] cList;
int numColors;
public Kuler(String kulers, int numC)
{
//Parse out the color list so we can generate a pallette
// This part works, but it's not yet working overall
colorList = split(colors, ',');
numColors = numC;
cList = new int[numColors];
for (int i = 0; i < numColors; i++)
{
cList[i] = unhex(colorList[i]);
}
}
public int getColor(int index)
{
if (index < numColors)
{
return cList[index];
}
else
{
return 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment