-
Notifications
You must be signed in to change notification settings - Fork 3
API Reference
This constructor will return a new instance of the OKColor struct to hold a color data.
Check out How to use section for basics.
With this method, you can set a color for OKColor struct in GameMaker format.
Parameters:
Name | Type | Description |
---|---|---|
color | Constant.Color |
The color definition in GameMaker supported format, can be c_color constant, #rrggbb, $bbggrr or a decimal number. |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color for OKColor struct in a string format.
Parameters:
Name | Type | Description |
---|---|---|
hex | String |
The color definition in hex format as a string "#rrggbb". |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in sRGB format. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[red] | Real |
The red component definition of RGB color (in 0-255 range). |
[green] | Real |
The green component definition of RGB color (in 0-255 range). |
[blue] | Real |
The blue component definition of RGB color (in 0-255 range). |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in non-gamma corrected Linear RGB format. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[red] | Real |
The red component definition of Linear RGB color (in 0-1 range). |
[green] | Real |
The green component definition of Linear RGB color (in 0-1 range). |
[blue] | Real |
The blue component definition of Linear RGB color (in 0-1 range). |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in HSV format. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[hue] | Real |
The hue component definition of HSV color (in 0-360 range). |
[saturation] | Real |
The saturation component definition of HSV color (in 0-1 range). |
[value] | Real |
The value component definition of HSV color (in 0-1 range). |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in HSL format. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[hue] | Real |
The hue component definition of HSL color (in 0-360 range). |
[saturation] | Real |
The saturation component definition of HSL color (in 0-1 range). |
[lightness] | Real |
The lightness component definition of HSL color (in 0-1 range). |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in CIELab format. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[lightness] | Real |
The lightness component definition of CIELab color (in 0-1 range). |
[a] | Real |
The a component definition of CIELab color (in -125 to 125 range). |
[b] | Real |
The b component definition of CIELab color (in -125 to 125 range). |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in CIELCH format. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[lightness] | Real |
The lightness component definition of CIELCH color (in 0-1 range). |
[chroma] | Real |
The chroma component definition of CIELCH color (in 0-150 range). |
[hue] | Real |
The hue component definition of CIELCH color (in 0-360 range). |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in OKLab format. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[lightness] | Real |
The lightness component definition of OKLab color (in 0-1 range). |
[a] | Real |
The a component definition of OKLab color (in -0.4 to 0.4 range). |
[b] | Real |
The b component definition of OKLab color (in -0.4 to 0.4 range). |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in OKLCH format. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[lightness] | Real |
The lightness component definition of OKLCH color (in 0-1 range). |
[chroma] | Real |
The chroma component definition of OKLCH color (in 0 to 0.4 range). |
[hue] | Real |
The hue component definition of OKLCH color (in 0-360 range). |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in LMS format that is mostly used for technical needs. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[long] | Real |
The long wavelength definition of LMS color. |
[medium] | Real |
The medium wavelength definition of LMS color. |
[short] | Real |
The short wavelength definition of LMS color. |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
With this method, you can set a color in CIE XYZ format that is mostly used for technical needs. Arguments are optional so you can set components separately.
Parameters:
Name | Type | Description |
---|---|---|
[x] | Real |
The X component definition of CIE XYZ color. |
[y] | Real |
The Y component definition of CIE XYZ color. |
[z] | Real |
The Z component definition of CIE XYZ color. |
Returns: Struct.OKColor
The same OKColor instance that the method was called on, for method chaining.
- Constructor
-
Setters
- setColor(color)
- setHex(hex)
- setRGB([red], [green], [blue])
- setLinearRGB([red], [green], [blue])
- setHSV([hue], [saturation], [value])
- setHSL([hue], [saturation], [lightness])
- setLab([lightness], [a], [b])
- setLCH([lightness], [chroma], [hue])
- setOKLab([lightness], [a], [b])
- setOKLCH([lightness], [chroma], [hue])
- setLMS([long], [medium], [short])
- setXYZ([x], [y], [z])
- Getters
- Gamut Mapping
- Color Getters
- Mixing
- Cloning