private Color OverrideImageColor(PaletteState state)
{
// We only intercept if we have a content to use for redirection
if (PaletteContent != null)
{
// We only override the normal/disabled states
if ((state == PaletteState.Normal) ||
(state == PaletteState.Disabled))
{
// ReSharper disable RedundantBaseQualifier
// Get the color map from the button spec
Color mapColor = _buttonSpec.GetColorMap(base.Target);
// ReSharper restore RedundantBaseQualifier
// If we are supposed to remap a color
if (mapColor != Color.Empty)
{
// ReSharper disable RedundantBaseQualifier
// Get the button style requested
ButtonStyle buttonStyle = _buttonSpec.GetStyle(base.Target);
// ReSharper restore RedundantBaseQualifier
// Only for ButtonSpec do we use the palette value
if (buttonStyle == ButtonStyle.ButtonSpec)
{
return(mapColor);
}
}
}
}
return(Color.Empty);
}