Add a toggle for colorblind friendly progress bar colors (#25318)

* Add a toggle for progress bar colors

* yeah this thing

* PJB review

* optimization
This commit is contained in:
Nemanja
2024-03-09 06:43:19 -05:00
committed by GitHub
parent 3f32fa804c
commit f3f4616c49
8 changed files with 169 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
using System.Numerics;
using Content.Client.DoAfter;
using Content.Client.UserInterface.Systems;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
@@ -9,11 +9,13 @@ namespace Content.Client.UserInterface.Controls
{
public float Progress;
private readonly ProgressColorSystem _progressColor = IoCManager.Resolve<IEntityManager>().System<ProgressColorSystem>();
protected override void Draw(DrawingHandleScreen handle)
{
var dims = Texture != null ? GetDrawDimensions(Texture) : UIBox2.FromDimensions(Vector2.Zero, PixelSize);
dims.Top = Math.Max(dims.Bottom - dims.Bottom * Progress,0);
handle.DrawRect(dims, DoAfterOverlay.GetProgressColor(Progress));
handle.DrawRect(dims, _progressColor.GetProgressColor(Progress));
base.Draw(handle);
}