import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
+import jalview.util.Comparison;
import java.awt.Color;
import java.util.Map;
}
/**
- * Returns the colour for symbol 'A'. Intended for use in a 'fixed colour'
- * colour scheme (for example a feature colour).
- */
- @Override
- public Color findColour()
- {
- // TODO delete this method in favour of ColorUtils.parseColourString()?
- return findColour('A');
- }
-
- /**
* Find a colour without an index in a sequence
*/
- @Override
public Color findColour(char c)
{
- return colors == null ? Color.white : colors[symbolIndex[c]];
+ Color colour = Color.white;
+
+ if (!Comparison.isGap(c) && colors != null && symbolIndex != null
+ && c < symbolIndex.length
+ && symbolIndex[c] < colors.length)
+ {
+ colour = colors[symbolIndex[c]];
+ }
+
+ return colour;
}
/**
return findColour(c, j, seq);
}
+ /**
+ * Default implementation looks up the residue colour in a fixed scheme, or
+ * returns White if not found. Override this method for a colour scheme that
+ * depends on the column position or sequence.
+ *
+ * @param c
+ * @param j
+ * @param seq
+ * @return
+ */
protected Color findColour(char c, int j, SequenceI seq)
{
- Color colour = Color.white;
-
- if (colors != null && symbolIndex != null && c < symbolIndex.length
- && symbolIndex[c] < colors.length)
- {
- colour = colors[symbolIndex[c]];
- }
- // colour = adjustColour(c, j, colour);
-
- return colour;
+ return findColour(c);
}
@Override