I’m trying to set Markerbackgrounds for a notepad++ plugin I’m writting so certain lines can be highlighted. The colours are stored as ints which are converted from Color.ToArgb():
int colour = Convert.ToInt32(Color.LightSkyBlue.ToArgb())
From what I understand of the Scintillia documentation it only accepts RGB colours so I use the following function to strip out the Alpha part of the colour. This does set a colour but instead of blue I’m getting orange instead of blue. Is this the right way to set a marker background colour?
private static void DefineColor(int type, int colour)
{
string hexValue = colour.ToString("X");
hexValue = hexValue.Remove(0, 2);
//hexValue = "0x" + hexValue
int decValue = Convert.ToInt32(ColorTranslator.FromHtml(hexValue));
//int decValue = int.Parse("FF", System.Globalization.NumberStyles.AllowHexSpecifier);
Win32.SendMessage(PluginBase.nppData._scintillaMainHandle, SciMsg.SCI_MARKERDEFINE, type, (int)SciMsg.SC_MARK_BACKGROUND);
Win32.SendMessage(PluginBase.nppData._scintillaMainHandle, SciMsg.SCI_MARKERSETBACK, type, decValue);
Win32.SendMessage(PluginBase.nppData._scintillaMainHandle, SciMsg.SCI_MARKERSETFORE, type, 0);
}
This strips off any alpha value:
This converts the color to a integer value:
Both together:
But I don’t know, if Scintillia uses the same color representation. May it stores the value in BGR instead of RGB format.