colour = colour.trim();
Color col = null;
- if (colour.length() == 6 && StringUtils.isHexString(colour))
+ if (StringUtils.isHexString(colour))
{
try
{
return col;
}
-
- public static boolean couldBeHexColor(String n) {
- return (n.length() > 0 && "abcdefABCDEF".indexOf(n.charAt(0)) >= 0);
- }
/**
* Constructs a colour from a text string. The hashcode of the whole string is
import static org.testng.AssertJUnit.assertNull;
import static org.testng.AssertJUnit.assertSame;
-import jalview.gui.JvOptionPane;
-
import java.awt.Color;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import jalview.gui.JvOptionPane;
+
public class ColorUtilsTest
{
*/
assertNull(ColorUtils.parseColourString(null));
assertNull(ColorUtils.parseColourString("rubbish"));
- assertEquals(Color.WHITE, ColorUtils.parseColourString("-1"));
+ assertNull(ColorUtils.parseColourString("-1"));
assertNull(ColorUtils.parseColourString(String
.valueOf(Integer.MAX_VALUE)));
assertNull(ColorUtils.parseColourString("100,200,300")); // out of range