git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ce6d1e0
)
JAL-4353 Add a 'random' colour to produce a random colour.
author
Ben Soares
<b.soares@dundee.ac.uk>
Wed, 6 Dec 2023 11:02:32 +0000
(11:02 +0000)
committer
Ben Soares
<b.soares@dundee.ac.uk>
Wed, 6 Dec 2023 11:02:32 +0000
(11:02 +0000)
src/jalview/util/ColorUtils.java
patch
|
blob
|
history
diff --git
a/src/jalview/util/ColorUtils.java
b/src/jalview/util/ColorUtils.java
index
9ed98bd
..
e9c66bd
100644
(file)
--- a/
src/jalview/util/ColorUtils.java
+++ b/
src/jalview/util/ColorUtils.java
@@
-24,10
+24,9
@@
package jalview.util;
-import java.util.Locale;
-
import java.awt.Color;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import java.util.Random;
@@
-234,6
+233,15
@@
public class ColorUtils
colour = colour.trim();
Color col = null;
+
+ if ("random".equals(colour))
+ {
+ Random rand = new Random();
+ col = new Color(rand.nextInt(256), rand.nextInt(256),
+ rand.nextInt(256));
+ return col;
+ }
+
try
{
int value = Integer.parseInt(colour, 16);