[gee-cvs] gabel/src/net/sf/gabel/social ColorTheme.java,1.1,1.2
Status: Alpha
Brought to you by:
alllee
|
From: Zoran R. <way...@us...> - 2006-06-24 23:45:41
|
Update of /cvsroot/gabel/gabel/src/net/sf/gabel/social In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32083/src/net/sf/gabel/social Modified Files: ColorTheme.java Log Message: Stable Social client/server. Many small bugfixes, features * and featurelettes to the client/server pair and to * individual experiments as well. Index: ColorTheme.java =================================================================== RCS file: /cvsroot/gabel/gabel/src/net/sf/gabel/social/ColorTheme.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ColorTheme.java 27 Feb 2006 04:59:17 -0000 1.1 --- ColorTheme.java 24 Jun 2006 23:45:35 -0000 1.2 *************** *** 10,13 **** --- 10,18 ---- public static final Color INACTIVE_COLOR = Color.GRAY; // color for inactive elements of interaction + public static final Color SUM_TOO_HIGH_COLOR = new Color(0xCC6600); // dark orange + public static final Color SUM_TOO_LOW_COLOR = new Color(0x008811); // green + public static final Color SUM_CORRECT_COLOR = TEXT_COLOR; + + public static Color colorByActivity(boolean active) { if (active) *************** *** 16,18 **** --- 21,42 ---- return INACTIVE_COLOR; } + + public static String colorToHtml(Color color) { + // we can't use String.format(...) from Java 1.5 + // NOTE: this only works for single-byte component values (i.e. up to 24bpp color depths) + final char[] hex = { + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' + }; + return new StringBuffer(7). + append('#'). + append(hex[color.getRed() >> 4]). + append(hex[color.getRed() & 0xf]). + append(hex[color.getGreen() >> 4]). + append(hex[color.getGreen() & 0xf]). + append(hex[color.getBlue() >> 4]). + append(hex[color.getBlue() & 0xf]). + toString(); + } + } |