- * We use darker text to indicate unselected buttons, lighter text for selected. Note you can't
- * guarantee that darkerThan/brighterThan undo each other, as they may result in black/white.
+ * @param colour
+ * @return
+ * @see http
+ * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/colortool.html#
+ * tkcode
+ */
+ public static final String toTkCode(Color colour)
+ {
+ String colstring = "#" + ((colour.getRed() < 16) ? "0" : "")
+ + Integer.toHexString(colour.getRed())
+ + ((colour.getGreen() < 16) ? "0" : "")
+ + Integer.toHexString(colour.getGreen())
+ + ((colour.getBlue() < 16) ? "0" : "")
+ + Integer.toHexString(colour.getBlue());
+ return colstring;
+ }
+
+ /**
+ * Returns a colour three shades darker. Note you can't guarantee that
+ * brighterThan reverses this, as darkerThan may result in black.