generated from pancake-llc/package
-
Notifications
You must be signed in to change notification settings - Fork 16
C.Color
yenmoc edited this page Jun 21, 2023
·
1 revision
Support method for color
Color ChangeAlpha(this Color, float)
Makes a copy of the color with a changed alpha value.
Example
private SpriteRenderer _renderer;
_renderer.color = _renderer.color.ChangeAlpha(0);
void SetAlpha(this SpriteRenderer, float)
void SetAlpha(this Graphic, float)
Change alpha value of color sprite renderer, graphic
Example
private SpriteRenderer _renderer;
spriteRenderer.SetAlpha(value)
void SetRed(this SpriteRenderer, float)
void SetRed(this Graphic, float)
Change red value of color sprite renderer, graphic
Example
private SpriteRenderer _renderer;
spriteRenderer.SetRed(value)
void SetGreen(this SpriteRenderer, float)
void SetGreen(this Graphic, float)
Change green value of color sprite renderer, graphic
Example
private SpriteRenderer _renderer;
spriteRenderer.SetGreen(value)
void SetBlue(this SpriteRenderer, float)
void SetBlue(this Graphic, float)
Change blue value of color sprite renderer, graphic
Example
private SpriteRenderer _renderer;
spriteRenderer.SetBlue(value)
void SetRGB(this SpriteRenderer spriteRenderer, float r, float g, float b)
void SetRGB(this Graphic graphic, float r, float g, float b)
Change red, green ,blue value of color sprite renderer, graphic
Example
private SpriteRenderer _renderer;
spriteRenderer.SetRGB(value)
string ToHtmlStringRGBA(this Color)
Returns the color as a hexadecimal string in the format "#RRGGBBAA".
Example
private SpriteRenderer _renderer;
var htmlColor = spriteRenderer.color.ToHtmlStringRGBA();
bool TryParseHtmlString(this string, out Color)
Returns the color parse from a hexadecimal string in the format "#RRGGBBAA".
Example
var htmlColor = "#FFFFFFF";
htmlColor.TryParseHtmlString(out var color);
string TextColor(this string text, string color)
string TextColor(this string text, Color color)
Returns the string content with color mark style html
Example
var str = "this is demo string";
var result = str.TextColor(Color.Red);