diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-06-11 00:57:30 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-06-15 10:45:44 +1000 |
| commit | 9508cd2e43c2d7cb0a335829becf418b50e9d098 (patch) | |
| tree | afc4614a33e65300a8003871ac4a40cde0e27588 /Color.cs | |
| parent | 040c41a4c2fb7d3fd5ade59027dc92fa71b2e35b (diff) | |
Added Color class
Diffstat (limited to 'Color.cs')
| -rw-r--r-- | Color.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Color.cs b/Color.cs new file mode 100644 index 0000000..583327e --- /dev/null +++ b/Color.cs @@ -0,0 +1,25 @@ +namespace HyperBooru.Client; + +public record Color { + public static Color AccentPrimary => new Color("accent-pri"); + public static Color Background => new Color("bg"); + public static Color ButtonPrimary => new Color("button-pri"); + public static Color ButtonSecondary => new Color("button-sec"); + public static Color ButtonWarning => new Color("button-warning"); + public static Color DialogBackground => new Color("dialog-bg"); + public static Color ErrorPrimary => new Color("error-pri"); + public static Color SwitchBackground => new Color("switch-bg"); + public static Color SwitchForeground => new Color("switch-fg"); + + public string CssString { get; private init; } + + public Color(int r, int g, int b) { + if(r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) + throw new ArgumentOutOfRangeException(); + + CssString = $"rgba({r}, {g}, {b}, 1)"; + } + + private Color(string varName) => + CssString = $"var(--col-{varName})"; +} |
