a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Client / Color
Represents a color with red, green, blue, and alpha (opacity) components.
new Color(
r,g,b,a):Color
Creates a new Color instance.
• r: number
The red component of the color (0-255).
• g: number
The green component of the color (0-255).
• b: number
The blue component of the color (0-255).
• a: number = 255
The alpha (opacity) component of the color (0-255).
a:
number=255
The alpha (opacity) component of the color (0-255).
b:
number
The blue component of the color (0-255).
g:
number
The green component of the color (0-255).
r:
number
The red component of the color (0-255).
staticaqua:Color
The color aqua (RGB: 0, 255, 255).
staticblack:Color
The color black (RGB: 0, 0, 0).
staticblue:Color
The color blue (RGB: 0, 0, 255).
staticbrown:Color
The color brown (RGB: 165, 42, 42).
staticchocolate:Color
The color chocolate (RGB: 210, 105, 30).
staticcoral:Color
The color coral (RGB: 255, 127, 80).
staticempty:Color
A transparent color (fully transparent).
staticfuchsia:Color
The color fuchsia (RGB: 255, 0, 255).
staticgold:Color
The color gold (RGB: 255, 215, 0).
staticgray:Color
The color gray (RGB: 128, 128, 128).
staticgreen:Color
The color green (RGB: 0, 128, 0).
statickhaki:Color
The color khaki (RGB: 240, 230, 140).
staticlightCoral:Color
The color light coral (RGB: 240, 128, 128).
staticlime:Color
The color lime (RGB: 0, 255, 0).
staticmaroon:Color
The color maroon (RGB: 128, 0, 0).
staticnavy:Color
The color navy (RGB: 0, 0, 128).
staticolive:Color
The color olive (RGB: 128, 128, 0).
staticorange:Color
The color orange (RGB: 255, 165, 0).
staticpink:Color
The color pink (RGB: 255, 192, 203).
staticpurple:Color
The color purple (RGB: 128, 0, 128).
staticred:Color
The color red (RGB: 255, 0, 0).
staticsalmon:Color
The color salmon (RGB: 250, 128, 114).
staticsilver:Color
The color silver (RGB: 192, 192, 192).
staticteal:Color
The color teal (RGB: 0, 128, 128).
statictransparent:Color
A fully transparent color.
staticwhite:Color
The color white (RGB: 255, 255, 255).
staticwhiteSmoke:Color
The color white smoke (RGB: 245, 245, 245).
staticyellow:Color
The color yellow (RGB: 255, 255, 0).
adjustBrightness(
factor):Color
Adjusts the brightness of the color.
• factor: number
The factor by which to adjust the brightness. Values less than 1 darken the color, values greater than 1 lighten the color.
A new Color instance with adjusted brightness.
blend(
other,ratio):Color
Blends this color with another color.
• other: Color
The color to blend with.
• ratio: number
The ratio of blending between this color and the other color. 0 means full color, 1 means full other color.
A new Color instance representing the blended color.
darken(
percentage):Color
Darkens the color by a percentage.
• percentage: number
The percentage by which to darken the color.
A new Color instance that is darker by the specified percentage.
equals(
other):boolean
Checks if this color is equal to another color.
• other: Color
The color to compare with.
boolean
true if the colors are equal, false otherwise.
invert():
Color
Inverts the color.
A new Color instance representing the inverted color.
lighten(
percentage):Color
Lightens the color by a percentage.
• percentage: number
The percentage by which to lighten the color.
A new Color instance that is lighter by the specified percentage.
toArgbHex():
string
Converts the color to a hexadecimal string (ARGB format).
string
A string in the format #aarrggbb.
toArray(): [
number,number,number,number]
Converts the color to an array.
[number, number, number, number]
An array representing the color with [r, g, b, a] components.
toHex():
string
Converts the color to a hexadecimal string (RGB format).
string
A string in the format #rrggbb.
toHsl():
object
Converts the color to HSL format.
object
An object with h (hue), s (saturation), l (lightness), and a (alpha) properties.
a:
number
h:
number
l:
number
s:
number
toJson():
object
Converts the color to a JSON object.
object
An object representing the color with r, g, b, and a properties.
a:
number
b:
number
g:
number
r:
number
toRgbaString():
string
Converts the color to an RGBA string.
string
A string in the format rgba(r, g, b, a).
staticfromArgb(a,r,g,b):Color
Creates a new Color instance from ARGB values.
• a: number
The alpha (opacity) component (0-255).
• r: number
The red component (0-255).
• g: number
The green component (0-255).
• b: number
The blue component (0-255).
A new Color instance.
staticfromHex(hex):Color
Creates a new Color instance from a hexadecimal color string.
• hex: string
The hexadecimal color string (e.g., #RRGGBB).
A new Color instance.
staticfromHsl(h,s,l,a):Color
Creates a new Color instance from HSL values.
• h: number
The hue (0-360 degrees).
• s: number
The saturation (0-100).
• l: number
The lightness (0-100).
• a: number = 255
The alpha (opacity) component (0-255).
A new Color instance.
staticfromRgb(r,g,b):Color
Creates a new Color instance from RGB values.
• r: number
The red component (0-255).
• g: number
The green component (0-255).
• b: number
The blue component (0-255).
A new Color instance with full opacity (alpha = 255).
staticfromRgbaString(rgba):Color
Creates a new Color instance from an RGBA string.
• rgba: string
The RGBA color string (e.g., rgba(255, 0, 0, 1)).
A new Color instance.
Error if the RGBA string is invalid.