Remove static Config.

This commit is contained in:
Ottermandias 2023-04-21 23:52:31 +02:00
parent aa4bc45641
commit be3c1c85aa
30 changed files with 363 additions and 440 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace Penumbra.UI.Classes;
@ -64,6 +65,13 @@ public static class Colors
// @formatter:on
};
public static uint Value(this ColorId color, Configuration config)
=> config.Colors.TryGetValue(color, out var value) ? value : color.Data().DefaultColor;
private static IReadOnlyDictionary<ColorId, uint> _colors = new Dictionary<ColorId, uint>();
/// <summary> Obtain the configured value for a color. </summary>
public static uint Value(this ColorId color)
=> _colors.TryGetValue(color, out var value) ? value : color.Data().DefaultColor;
/// <summary> Set the configurable colors dictionary to a value. </summary>
public static void SetColors(Configuration config)
=> _colors = config.Colors;
}