Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Empyrean.Utils.Colorist Class Reference

Static Public Member Functions

static Color Lighten (this Color c, float value=0.2f)
 
static Color Darken (this Color c, float value=0.2f)
 
static Color Inverse (this Color color)
 
static Color HSVtoRGB (HSVColor hsv)
 
static Color HSVtoRGB (float hue, float saturation, float value, float alpha=1f)
 
static HSVColor RGBtoHSV (Color color)
 
static HSVColor RGBtoHSV (float r, float g, float b, float a=1f)
 
static HSLColor RGBtoHSL (float r, float g, float b, float a=1f)
 
static HSLColor RGBtoHSL (Color color)
 
static HSLColor HSVtoHSL (HSVColor hsv)
 
static HSVColor HSLtoHSV (HSLColor hsl)
 
static string ColorToHex (Color32 color)
 
static Color HexToColor (string hex)
 
static Color SlightlyTransparent (Color color)
 
static Color SetAlpha (this Color color, float alpha=0.5f)
 

Static Public Attributes

static readonly Color steelBlue = new Color32(70, 130, 180, byte.MaxValue)
 
static readonly Color lightSteelBlue = new Color32(176, 196, 222, byte.MaxValue)
 
static readonly Color white32 = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue)
 
static readonly Color black = new Color32(0, 0, 0, byte.MaxValue)
 
static readonly Color nearlyBlack = new Color(0.1f, 0.1f, 0.1f)
 
static readonly Color red10 = new Color(1f, 0.9f, 0.9f)
 
static readonly Color red25 = new Color(1f, 0.75f, 0.75f)
 
static readonly Color red50 = new Color(1f, 0.5f, 0.5f)
 
static readonly Color red75 = new Color(1f, 0.25f, 0.25f)
 
static readonly Color green10 = new Color(0.9f, 1f, 0.9f)
 
static readonly Color green25 = new Color(0.75f, 1f, 0.75f)
 
static readonly Color green50 = new Color(0.5f, 1f, 0.5f)
 
static readonly Color green75 = new Color(0.25f, 1f, 0.25f)
 
static readonly Color blue10 = new Color(0.9f, 0.9f, 1f)
 
static readonly Color blue25 = new Color(0.75f, 0.75f, 1f)
 
static readonly Color blue50 = new Color(0.5f, 0.5f, 1f)
 
static readonly Color blue75 = new Color(0.25f, 0.25f, 1f)
 
static readonly Color cyan25 = new Color(0.75f, 1f, 1f)
 
static readonly Color cyan50 = new Color(0.5f, 1f, 1f)
 
static readonly Color cyan75 = new Color(0.25f, 1f, 1f)
 
static readonly Color magenta25 = new Color(1f, 0.75f, 1f)
 
static readonly Color magenta50 = new Color(1f, 0.5f, 1f)
 
static readonly Color magenta75 = new Color(1f, 0.25f, 1f)
 
static readonly Color yellow25 = new Color(1f, 1f, 0.75f)
 
static readonly Color yellow50 = new Color(1f, 1f, 0.5f)
 
static readonly Color yellow75 = new Color(1f, 1f, 0.25f)
 
static readonly Color transparentBlack = new Color(0f, 0f, 0f, 0f)
 
static readonly Color transparentWhite = new Color(1f, 1f, 1f, 0f)
 
static readonly Color white = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue)
 
static readonly Color red = new Color32(byte.MaxValue, 0, 0, byte.MaxValue)
 
static readonly Color brown = new Color32(165, 42, 42, byte.MaxValue)
 
static readonly Color gray = new Color32(190, 190, 190, byte.MaxValue)
 
static readonly Color pink = new Color32(byte.MaxValue, 192, 203, byte.MaxValue)
 
static readonly Color green = new Color32(0, byte.MaxValue, 0, byte.MaxValue)
 
static readonly Color tan = new Color32(210, 180, 140, byte.MaxValue)
 
static readonly Color yellow = new Color32(byte.MaxValue, byte.MaxValue, 0, byte.MaxValue)
 
static readonly Color maroon = new Color32(128, 0, 0, byte.MaxValue)
 
static readonly Color navyBlue = new Color32(0, 0, 128, byte.MaxValue)
 
static readonly Color magenta = new Color32(byte.MaxValue, 0, byte.MaxValue, byte.MaxValue)
 
static readonly Color blue = new Color32(0, 0, byte.MaxValue, byte.MaxValue)
 
static readonly Color aqua = new Color32(0, byte.MaxValue, byte.MaxValue, byte.MaxValue)
 
static readonly Color orange = new Color32(byte.MaxValue, 165, 0, byte.MaxValue)
 

Detailed Description

Definition at line 6 of file Colorist.cs.

Member Function Documentation

◆ ColorToHex()

static string Empyrean.Utils.Colorist.ColorToHex ( Color32  color)
inlinestatic

Definition at line 232 of file Colorist.cs.

233 {
234 return color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2") + color.a.ToString("X2");
235 }

Referenced by HexInput.SelectColor().

◆ Darken()

static Color Empyrean.Utils.Colorist.Darken ( this Color  c,
float  value = 0::2f 
)
inlinestatic

Definition at line 97 of file Colorist.cs.

98 {
99 return new Color(c.r - value, c.g - value, c.b - value);
100 }

References Color.

◆ HexToColor()

static Color Empyrean.Utils.Colorist.HexToColor ( string  hex)
inlinestatic

Definition at line 237 of file Colorist.cs.

238 {
239 byte r = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber);
240 byte g = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber);
241 byte b = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
242 byte a = byte.MaxValue;
243 if (hex.Length == 8)
244 {
245 a = byte.Parse(hex.Substring(6, 2), NumberStyles.HexNumber);
246 }
247 return new Color32(r, g, b, a);
248 }

Referenced by HexInput.GetColorByHex().

◆ HSLtoHSV()

static HSVColor Empyrean.Utils.Colorist.HSLtoHSV ( HSLColor  hsl)
inlinestatic

Definition at line 223 of file Colorist.cs.

224 {
225 HSVColor result = default(HSVColor);
226 result.h = hsl.h;
227 result.v = (2f * hsl.l + hsl.s * (1f - Mathf.Abs(2f * hsl.l - 1f))) / 2f;
228 result.s = 2f * (result.v - hsl.l) / result.v;
229 return result;
230 }
float l
Definition: HSLColor.cs:7
float h
Definition: HSLColor.cs:3
float v
Definition: HSVColor.cs:7

References HSLColor.h, HSLColor.l, and HSVColor.v.

◆ HSVtoHSL()

static HSLColor Empyrean.Utils.Colorist.HSVtoHSL ( HSVColor  hsv)
inlinestatic

Definition at line 214 of file Colorist.cs.

215 {
216 HSLColor result = default(HSLColor);
217 result.h = hsv.h;
218 result.l = hsv.v * (2f - hsv.s) / 2f;
219 result.s = hsv.v * hsv.s / (1f - Mathf.Abs(result.l - 1f));
220 return result;
221 }
float h
Definition: HSVColor.cs:3
float s
Definition: HSVColor.cs:5

References HSVColor.h, HSLColor.l, and HSVColor.s.

◆ HSVtoRGB() [1/2]

static Color Empyrean.Utils.Colorist.HSVtoRGB ( float  hue,
float  saturation,
float  value,
float  alpha = 1f 
)
inlinestatic

Definition at line 112 of file Colorist.cs.

113 {
114 int num = (int)(hue / 60f) % 6;
115 float num2 = hue / 60f - (float)(int)(hue / 60f);
116 float num3 = value * (1f - saturation);
117 float num4 = value * (1f - num2 * saturation);
118 float num5 = value * (1f - (1f - num2) * saturation);
119 return num switch
120 {
121 0 => new Color(value, num5, num3, alpha),
122 1 => new Color(num4, value, num3, alpha),
123 2 => new Color(num3, value, num5, alpha),
124 3 => new Color(num3, num4, value, alpha),
125 4 => new Color(num5, num3, value, alpha),
126 _ => new Color(value, num3, num4, alpha),
127 };
128 }

References Color.

◆ HSVtoRGB() [2/2]

static Color Empyrean.Utils.Colorist.HSVtoRGB ( HSVColor  hsv)
inlinestatic

◆ Inverse()

static Color Empyrean.Utils.Colorist.Inverse ( this Color  color)
inlinestatic

Definition at line 102 of file Colorist.cs.

103 {
104 return new Color(1f - color.r, 1f - color.g, 1f - color.b, color.a);
105 }

References Color.

◆ Lighten()

static Color Empyrean.Utils.Colorist.Lighten ( this Color  c,
float  value = 0::2f 
)
inlinestatic

Definition at line 92 of file Colorist.cs.

93 {
94 return new Color(c.r + value, c.g + value, c.b + value);
95 }

References Color.

◆ RGBtoHSL() [1/2]

static HSLColor Empyrean.Utils.Colorist.RGBtoHSL ( Color  color)
inlinestatic

Definition at line 209 of file Colorist.cs.

210 {
211 return RGBtoHSL(color.r, color.g, color.b, color.a);
212 }
static HSLColor RGBtoHSL(float r, float g, float b, float a=1f)
Definition: Colorist.cs:174

References Empyrean.Utils.Colorist.RGBtoHSL().

◆ RGBtoHSL() [2/2]

static HSLColor Empyrean.Utils.Colorist.RGBtoHSL ( float  r,
float  g,
float  b,
float  a = 1f 
)
inlinestatic

Definition at line 174 of file Colorist.cs.

175 {
176 HSLColor result = default(HSLColor);
177 float num = Mathf.Max(r, g, b);
178 float num2 = Mathf.Min(r, g, b);
179 float num3 = num - num2;
180 result.a = a;
181 if (num == 0f || num2 == 1f || num3 == 0f)
182 {
183 result.h = 0f;
184 result.s = 0f;
185 return result;
186 }
187 if (num == r)
188 {
189 result.h = (g - b) / num3;
190 }
191 else if (num == g)
192 {
193 result.h = (b - r) / num3 + 2f;
194 }
195 else
196 {
197 result.h = (r - g) / num3 + 4f;
198 }
199 result.h *= 60f;
200 if (result.h < 0f)
201 {
202 result.h += 360f;
203 }
204 result.l = (num + num2) / 2f;
205 result.s = num3 / (1f - Mathf.Abs(2f * result.l - 1f));
206 return result;
207 }

References HSLColor.h, and HSLColor.l.

Referenced by Empyrean.Utils.Colorist.RGBtoHSL().

◆ RGBtoHSV() [1/2]

static HSVColor Empyrean.Utils.Colorist.RGBtoHSV ( Color  color)
inlinestatic

Definition at line 130 of file Colorist.cs.

131 {
132 if (color.r == color.g && color.g == color.b)
133 {
134 color.r += 0.01f;
135 }
136 return RGBtoHSV(color.r, color.g, color.b, color.a);
137 }
static HSVColor RGBtoHSV(Color color)
Definition: Colorist.cs:130

References Empyrean.Utils.Colorist.RGBtoHSV().

Referenced by Empyrean.Utils.Colorist.RGBtoHSV(), SelectedColorController.Select(), and Empyrean.Utils.Extensions.ToHsv().

◆ RGBtoHSV() [2/2]

static HSVColor Empyrean.Utils.Colorist.RGBtoHSV ( float  r,
float  g,
float  b,
float  a = 1f 
)
inlinestatic

Definition at line 139 of file Colorist.cs.

140 {
141 HSVColor result = default(HSVColor);
142 float num = Mathf.Max(r, g, b);
143 float num2 = Mathf.Min(r, g, b);
144 float num3 = num - num2;
145 result.a = a;
146 if (num == 0f || num2 == 1f || num3 == 0f)
147 {
148 result.h = 0f;
149 result.s = 0f;
150 return result;
151 }
152 if (num == r)
153 {
154 result.h = (g - b) / num3;
155 }
156 else if (num == g)
157 {
158 result.h = (b - r) / num3 + 2f;
159 }
160 else
161 {
162 result.h = (r - g) / num3 + 4f;
163 }
164 result.h *= 60f;
165 if (result.h < 0f)
166 {
167 result.h += 360f;
168 }
169 result.v = num;
170 result.s = num3 / num;
171 return result;
172 }

References HSVColor.h.

◆ SetAlpha()

static Color Empyrean.Utils.Colorist.SetAlpha ( this Color  color,
float  alpha = 0::5f 
)
inlinestatic

Definition at line 255 of file Colorist.cs.

256 {
257 color.a = alpha;
258 return color;
259 }

◆ SlightlyTransparent()

static Color Empyrean.Utils.Colorist.SlightlyTransparent ( Color  color)
inlinestatic

Definition at line 250 of file Colorist.cs.

251 {
252 return color.SetAlpha(0.75f);
253 }

Member Data Documentation

◆ aqua

readonly Color Empyrean.Utils.Colorist.aqua = new Color32(0, byte.MaxValue, byte.MaxValue, byte.MaxValue)
static

Definition at line 88 of file Colorist.cs.

◆ black

readonly Color Empyrean.Utils.Colorist.black = new Color32(0, 0, 0, byte.MaxValue)
static

Definition at line 14 of file Colorist.cs.

◆ blue

readonly Color Empyrean.Utils.Colorist.blue = new Color32(0, 0, byte.MaxValue, byte.MaxValue)
static

Definition at line 86 of file Colorist.cs.

◆ blue10

readonly Color Empyrean.Utils.Colorist.blue10 = new Color(0.9f, 0.9f, 1f)
static

Definition at line 34 of file Colorist.cs.

◆ blue25

readonly Color Empyrean.Utils.Colorist.blue25 = new Color(0.75f, 0.75f, 1f)
static

Definition at line 36 of file Colorist.cs.

◆ blue50

readonly Color Empyrean.Utils.Colorist.blue50 = new Color(0.5f, 0.5f, 1f)
static

Definition at line 38 of file Colorist.cs.

◆ blue75

readonly Color Empyrean.Utils.Colorist.blue75 = new Color(0.25f, 0.25f, 1f)
static

Definition at line 40 of file Colorist.cs.

◆ brown

readonly Color Empyrean.Utils.Colorist.brown = new Color32(165, 42, 42, byte.MaxValue)
static

Definition at line 68 of file Colorist.cs.

◆ cyan25

readonly Color Empyrean.Utils.Colorist.cyan25 = new Color(0.75f, 1f, 1f)
static

Definition at line 42 of file Colorist.cs.

◆ cyan50

readonly Color Empyrean.Utils.Colorist.cyan50 = new Color(0.5f, 1f, 1f)
static

Definition at line 44 of file Colorist.cs.

◆ cyan75

readonly Color Empyrean.Utils.Colorist.cyan75 = new Color(0.25f, 1f, 1f)
static

Definition at line 46 of file Colorist.cs.

◆ gray

readonly Color Empyrean.Utils.Colorist.gray = new Color32(190, 190, 190, byte.MaxValue)
static

Definition at line 70 of file Colorist.cs.

◆ green

readonly Color Empyrean.Utils.Colorist.green = new Color32(0, byte.MaxValue, 0, byte.MaxValue)
static

Definition at line 74 of file Colorist.cs.

◆ green10

readonly Color Empyrean.Utils.Colorist.green10 = new Color(0.9f, 1f, 0.9f)
static

Definition at line 26 of file Colorist.cs.

◆ green25

readonly Color Empyrean.Utils.Colorist.green25 = new Color(0.75f, 1f, 0.75f)
static

Definition at line 28 of file Colorist.cs.

◆ green50

readonly Color Empyrean.Utils.Colorist.green50 = new Color(0.5f, 1f, 0.5f)
static

Definition at line 30 of file Colorist.cs.

◆ green75

readonly Color Empyrean.Utils.Colorist.green75 = new Color(0.25f, 1f, 0.25f)
static

Definition at line 32 of file Colorist.cs.

◆ lightSteelBlue

readonly Color Empyrean.Utils.Colorist.lightSteelBlue = new Color32(176, 196, 222, byte.MaxValue)
static

Definition at line 10 of file Colorist.cs.

◆ magenta

readonly Color Empyrean.Utils.Colorist.magenta = new Color32(byte.MaxValue, 0, byte.MaxValue, byte.MaxValue)
static

Definition at line 84 of file Colorist.cs.

◆ magenta25

readonly Color Empyrean.Utils.Colorist.magenta25 = new Color(1f, 0.75f, 1f)
static

Definition at line 48 of file Colorist.cs.

◆ magenta50

readonly Color Empyrean.Utils.Colorist.magenta50 = new Color(1f, 0.5f, 1f)
static

Definition at line 50 of file Colorist.cs.

◆ magenta75

readonly Color Empyrean.Utils.Colorist.magenta75 = new Color(1f, 0.25f, 1f)
static

Definition at line 52 of file Colorist.cs.

◆ maroon

readonly Color Empyrean.Utils.Colorist.maroon = new Color32(128, 0, 0, byte.MaxValue)
static

Definition at line 80 of file Colorist.cs.

◆ navyBlue

readonly Color Empyrean.Utils.Colorist.navyBlue = new Color32(0, 0, 128, byte.MaxValue)
static

Definition at line 82 of file Colorist.cs.

◆ nearlyBlack

readonly Color Empyrean.Utils.Colorist.nearlyBlack = new Color(0.1f, 0.1f, 0.1f)
static

Definition at line 16 of file Colorist.cs.

◆ orange

readonly Color Empyrean.Utils.Colorist.orange = new Color32(byte.MaxValue, 165, 0, byte.MaxValue)
static

Definition at line 90 of file Colorist.cs.

◆ pink

readonly Color Empyrean.Utils.Colorist.pink = new Color32(byte.MaxValue, 192, 203, byte.MaxValue)
static

Definition at line 72 of file Colorist.cs.

◆ red

readonly Color Empyrean.Utils.Colorist.red = new Color32(byte.MaxValue, 0, 0, byte.MaxValue)
static

Definition at line 66 of file Colorist.cs.

◆ red10

readonly Color Empyrean.Utils.Colorist.red10 = new Color(1f, 0.9f, 0.9f)
static

Definition at line 18 of file Colorist.cs.

◆ red25

readonly Color Empyrean.Utils.Colorist.red25 = new Color(1f, 0.75f, 0.75f)
static

Definition at line 20 of file Colorist.cs.

◆ red50

readonly Color Empyrean.Utils.Colorist.red50 = new Color(1f, 0.5f, 0.5f)
static

Definition at line 22 of file Colorist.cs.

◆ red75

readonly Color Empyrean.Utils.Colorist.red75 = new Color(1f, 0.25f, 0.25f)
static

Definition at line 24 of file Colorist.cs.

◆ steelBlue

readonly Color Empyrean.Utils.Colorist.steelBlue = new Color32(70, 130, 180, byte.MaxValue)
static

Definition at line 8 of file Colorist.cs.

◆ tan

readonly Color Empyrean.Utils.Colorist.tan = new Color32(210, 180, 140, byte.MaxValue)
static

Definition at line 76 of file Colorist.cs.

◆ transparentBlack

readonly Color Empyrean.Utils.Colorist.transparentBlack = new Color(0f, 0f, 0f, 0f)
static

Definition at line 60 of file Colorist.cs.

◆ transparentWhite

readonly Color Empyrean.Utils.Colorist.transparentWhite = new Color(1f, 1f, 1f, 0f)
static

Definition at line 62 of file Colorist.cs.

◆ white

readonly Color Empyrean.Utils.Colorist.white = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue)
static

Definition at line 64 of file Colorist.cs.

◆ white32

readonly Color Empyrean.Utils.Colorist.white32 = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue)
static

Definition at line 12 of file Colorist.cs.

◆ yellow

readonly Color Empyrean.Utils.Colorist.yellow = new Color32(byte.MaxValue, byte.MaxValue, 0, byte.MaxValue)
static

Definition at line 78 of file Colorist.cs.

◆ yellow25

readonly Color Empyrean.Utils.Colorist.yellow25 = new Color(1f, 1f, 0.75f)
static

Definition at line 54 of file Colorist.cs.

◆ yellow50

readonly Color Empyrean.Utils.Colorist.yellow50 = new Color(1f, 1f, 0.5f)
static

Definition at line 56 of file Colorist.cs.

◆ yellow75

readonly Color Empyrean.Utils.Colorist.yellow75 = new Color(1f, 1f, 0.25f)
static

Definition at line 58 of file Colorist.cs.


The documentation for this class was generated from the following file: