textmode.js / Textmodifier / background
Method: background()
Call Signature
ts
background(): TextmodeColor;Current background color.
Returns
Current background color.
Example
Call Signature
ts
background(gray, alpha?): void;Set the background color using a grayscale value.
Parameters
| Parameter | Type | Description |
|---|---|---|
gray | number | Grayscale value (0-255) |
alpha? | number | Optional alpha value (0-255) |
Returns
void
Example
Call Signature
ts
background(
r,
g,
b,
a?): void;Set the background color using RGB(A) values.
Parameters
| Parameter | Type | Description |
|---|---|---|
r | number | Red component (0-255) |
g | number | Green component (0-255) |
b | number | Blue component (0-255) |
a? | number | Optional alpha component (0-255) |
Returns
void
Example
Call Signature
ts
background(value): void;Set the background color using a CSS string or TextmodeColor object.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | | string | TextmodeColor | Hex string, rgb()/rgba() string, or an existing color object |
Returns
void