Changing existing scheme palette colors


https://www.nevron.com/Forum/Topic7927.aspx
Print Topic | Close Window

By Craig Swearingen - 11 Years Ago
I have code similar to the following to allow the end user to set the palette they would like to use. You'll notice if the Longhorn scheme is selected I instead turn it into a custom scheme and just change the Window value in it. I change this value because the Longhorn.Window value makes it hard to see a mouse pointer and keyboard cursor over entry field controls.

private void miPalette_Click(object sender, CommandEventArgs e)
{
if (NUIManager.Palette.ShowEditor() == DialogResult.OK)
{
if (NUIManager.Palette.Scheme == ColorScheme.Longhorn)
{
NUIManager.Palette.Scheme = ColorScheme.Custom;
NUIManager.Palette.Window = Color.FromArgb(60, 58, 53);
}
}
}

Is there a way I can directly change the Longhorn scheme color values instead? Is this the best way to address this issue? Given I'm exposing the palette editor to the end user I'd like a little control over the contents of it.
By Nevron Support - 11 Years Ago
Hello Craig,

You can set desired custom palette and serialize it into a file. Than you can load it and apply it on the whole application or on particular control(s).

Here is a small code snipped which demonstrates how to save and load custom palette:

//save
NPalette p = new NPalette();
p.Scheme = ColorScheme.Longhorn;
p.Window = Color.FromArgb(60, 58, 53);

p.SaveToFile(filePath);

//load
NPalette p = NPalette.FromFile(filePath, typeof(NPalette));

I hope this helps.
By Craig Swearingen - 11 Years Ago
Thanks for the suggestion. I believe the code I have already is accomplishing the same thing, however. I don't see how having it saved and then loading it back is any different. I specifically would like to know if I can somehow change the palette colors for the Longhorn scheme. Is there someway to do this?

I was hoping so as this would allow me to continue to let the user see the NUIManager.Palette.ShowEditor() dialog. Otherwise all I can come up with is replacing this dialog with my own so I can control all the scheme color choices. I'd prefer to continue using the Nevron dialog but I'd like to tweek the scheme palette colors to fix a couple of issues I see. Is there a way to edit these hard-coded palette colors?
By Nevron Support - 11 Years Ago
Hello Craig,

You cannot edit the colors of predefined palette.