blob: 583327e0cc6b2ccf38b68080c10a002a1673f0a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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})";
}
|