/** * Returns the SColor whose value matches the one passed in. If no SColor * constant matches that value, then a cached or new SColor is returned that * matches the provided value. * * This method constructs a list of the SColor constants the first time it * is called. * * @param argb an int encoding 256 * 256 * 256 * alpha + 256 * 256 * red + 256 * green + blue * @return the SColor with value argb */ public SColor colorForValue(int argb) { if (valueLookup.size == 0) { int len = SColor.FULL_PALETTE.length; SColor sc; for (int i = 0; i < len; i++) { sc = SColor.FULL_PALETTE[i]; valueLookup.put(Color.argb8888(sc), sc); } } return valueLookup.containsKey(argb) ? valueLookup.get(argb) : asSColor(argb); }