added popup color to scheme
This commit is contained in:
parent
1145336538
commit
cafe71c50b
|
@ -14,6 +14,9 @@ namespace ColorTool
|
|||
public uint? foreground = null;
|
||||
public uint? background = null;
|
||||
|
||||
public uint? popupForeground = null;
|
||||
public uint? popupBackground = null;
|
||||
|
||||
public int CalculateIndex(uint value) =>
|
||||
colorTable.Select((color, idx) => Tuple.Create(color, idx))
|
||||
.OrderBy(Difference(value))
|
||||
|
|
|
@ -370,12 +370,18 @@ namespace ColorTool
|
|||
{
|
||||
csbiex.ColorTable[i] = colorScheme.colorTable[i];
|
||||
}
|
||||
if(colorScheme.background != null && colorScheme.foreground != null)
|
||||
if (colorScheme.background != null && colorScheme.foreground != null)
|
||||
{
|
||||
int fgidx = colorScheme.CalculateIndex(colorScheme.foreground.Value);
|
||||
int bgidx = colorScheme.CalculateIndex(colorScheme.background.Value);
|
||||
csbiex.wAttributes = (ushort)(fgidx | (bgidx << 4));
|
||||
}
|
||||
if (colorScheme.popupBackground != null && colorScheme.popupForeground != null)
|
||||
{
|
||||
int fgidx = colorScheme.CalculateIndex(colorScheme.popupForeground.Value);
|
||||
int bgidx = colorScheme.CalculateIndex(colorScheme.popupBackground.Value);
|
||||
csbiex.wPopupAttributes = (ushort)(fgidx | (bgidx << 4));
|
||||
}
|
||||
SetConsoleScreenBufferInfoEx(hOut, ref csbiex);
|
||||
}
|
||||
if (success)
|
||||
|
|
Loading…
Reference in a new issue