[Jalview-discuss] proper way to add a new color scheme
Huseyin Kaya
hkaya at iontek.com.tr
Wed Dec 9 08:04:17 GMT 2009
Hi everyone,
I was in need for a color scheme that is very similar to "Percentage
Identity".
But it should only paint the backgrounds of bases different than
consensus with the color pink.
It is very simple in the sense that it doesn't require threshold values.
I couldn't find a way to do this from menus including "User defined"
color scheme menu.
So i simply had to change PIDColorScheme.findColor method like this:
public Color findColour(char c, int j)
{
if ('a' <= c && c <= 'z')
{
c -= ('a' - 'A');
}
if (consensus == null || j >= consensus.length || consensus[j] == null)
{
return Color.white;
}
Color currentColour = Color.white;
if (consensus.length <= j)
{
return Color.white;
}
if (consensus[j].contains(String.valueOf(c)))
{
currentColour = Color.WHITE;
} else
{
currentColour = Color.PINK;
}
return currentColour;
}
I will be glad if you point a better way to do this. How can i create
this color scheme just by using the menus
not by ruining the source code.
Huseyin Kaya
More information about the Jalview-discuss
mailing list