JAL-1609 refactored colour by sequence command, now performs ok
[jalview.git] / test / jalview / util / ColorUtilsTest.java
index da2e6ca..3bbcf27 100644 (file)
@@ -39,4 +39,17 @@ public class ColorUtilsTest
             ColorUtils.brighterThan(darkColour));
     assertNull(ColorUtils.brighterThan(null));
   }
+
+  /**
+   * @see http://www.rtapo.com/notes/named_colors.html
+   */
+  @Test
+  public void testToTkCode()
+  {
+    assertEquals("#fffafa", ColorUtils.toTkCode(new Color(255, 250, 250))); // snow
+    assertEquals("#e6e6fa", ColorUtils.toTkCode(new Color(230, 230, 250))); // lavender
+    assertEquals("#dda0dd", ColorUtils.toTkCode(new Color(221, 160, 221))); // plum
+    assertEquals("#800080", ColorUtils.toTkCode(new Color(128, 0, 128))); // purple
+    assertEquals("#00ff00", ColorUtils.toTkCode(new Color(0, 255, 0))); // lime
+  }
 }