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:
Phantom
2025-12-15 00:48:42 +01:00
parent bb2e22ecf2
commit 7f2f73afd8
3 changed files with 7 additions and 2 deletions

View File

@@ -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)

View File

@@ -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>

View File

@@ -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],