mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
GUI桌面环境
This commit is contained in:
17
Gui/UILib/Extensions.cs
Normal file
17
Gui/UILib/Extensions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace CMLeonOS.Gui.UILib
|
||||
{
|
||||
internal static class Extensions
|
||||
{
|
||||
internal static float GetLuminance(this Color color)
|
||||
{
|
||||
return (float)((color.R * 0.2126) + (color.G * 0.7152) + (color.B * 0.0722));
|
||||
}
|
||||
|
||||
internal static Color GetForegroundColour(this Color color)
|
||||
{
|
||||
return color.GetLuminance() < 140 ? Color.White : Color.Black;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user