Created
September 25, 2009 05:32
-
-
Save jafish/193344 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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