Added Luminance property and updated authors
-Added public Luminance property in Color.cs to calculate colour brightness. -Refactored Dropdown.cs to use Luminance instead of manual calculation. -Updated author list in AboutDialog.cs by adding ‘Michael Salvini’.
This commit is contained in:
@@ -98,6 +98,7 @@ namespace FlaxEditor.Windows
|
||||
"Chandler Cox",
|
||||
"Ari Vuollet",
|
||||
"Vincent Saarmann",
|
||||
"Michael Salvini",
|
||||
});
|
||||
authors.Sort();
|
||||
var authorsLabel = new Label(4, topParentControl.Bottom + 20, Width - 8, 70)
|
||||
|
||||
@@ -82,6 +82,11 @@ namespace FlaxEngine
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the brightness of the color
|
||||
/// </summary>
|
||||
public float Luminance => R * 0.299f + G * 0.587f + B * 0.114f;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the minimum color component value: Min(r,g,b).
|
||||
/// </summary>
|
||||
|
||||
@@ -588,7 +588,6 @@ namespace FlaxEngine.GUI
|
||||
AutoFocus = false,
|
||||
Size = size,
|
||||
};
|
||||
float brightness = TextColorHighlighted.R * 0.299f + TextColorHighlighted.G * 0.587f + TextColorHighlighted.B * 0.114f;
|
||||
var label = new DropdownLabel
|
||||
{
|
||||
AutoFocus = true,
|
||||
@@ -596,7 +595,7 @@ namespace FlaxEngine.GUI
|
||||
Size = new Float2(size.X - margin, size.Y),
|
||||
Font = Font,
|
||||
TextColor = TextColor * 0.9f,
|
||||
TextColorHighlighted = brightness < 0.05f ? Color.Lerp(TextColorHighlighted, Color.White, 0.3f) : TextColorHighlighted,
|
||||
TextColorHighlighted = TextColorHighlighted.Luminance < 0.05f ? Color.Lerp(TextColorHighlighted, Color.White, 0.3f) : TextColorHighlighted,
|
||||
HorizontalAlignment = HorizontalAlignment,
|
||||
VerticalAlignment = VerticalAlignment,
|
||||
Text = _items[i],
|
||||
|
||||
Reference in New Issue
Block a user