Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/TextAliveJp/textalive-app-api/llms.txt

Use this file to discover all available pages before exploring further.

The Color class stores RGBA color data and lets you read or write color values in a variety of formats — 32-bit integers, hex strings, and CSS-compatible strings. You can construct a Color from a hex string, a 32-bit integer, or another IColor-compatible object. Color implements the IColor interface.

Constructor

new Color(color?: string | number | IColor)
color
string | number | IColor
Optional initial value. Accepted formats:
  • string — hex color string such as "#ff0000" (RGB) or "#ff000080" (RGBA)
  • number — 32-bit ARGB integer or 24-bit RGB integer
  • IColor — copies channel values from another color object

Practical example

import { Color } from "textalive-app-api";

// In onTimeUpdate:
const char = player.video?.findChar(position);
if (char) {
  const progress = char.progress(position);
  const c = new Color("#ff4400");
  c.a = Math.round(progress * 255);
  char.color = c;
}

IColor interface

The IColor interface defines the contract that Color implements. All channel values range from 0 to 255.

Channel properties

a
number
Alpha channel. 0 is fully transparent, 255 is fully opaque.
r
number
Red channel [0–255].
g
number
Green channel [0–255].
b
number
Blue channel [0–255].

Integer representation

value
number
Get or set the color as a 32-bit ARGB integer.

String representations

rgb
string
Hex string representing the RGB channels, e.g. "112233".
cssRgb
string
CSS rgb() string, e.g. "rgb(17,34,51)".
rgba
string
Hex string representing RGBA channels with a leading #, e.g. "#11223300".
argb
string
Hex string representing ARGB channels with a 0x prefix, e.g. "0x00112233".
cssRgba
string
CSS rgba() string, e.g. "rgba(17,34,51,0)".

Color-specific getters

These properties are available on Color instances (not on the base IColor interface).
valueArgb
number
The color as a 32-bit ARGB integer.
valueRgb
number
The color as a 24-bit RGB integer (alpha is ignored).
hexRgb
string
Hex string with a leading #, e.g. "#rrggbb".
hexA
string
Hex string of the alpha channel component only.

Methods

eq
(color: Color) => boolean
Returns true if all four channel values of color match this instance.
toString
(withAlpha?: boolean) => string
Returns a string representation of the color.
from
(color: string | number | IColor) => void
Sets the color from any supported source format — hex string, integer, or another IColor.
fromString
(color: string) => void
Sets the color from a hex string. Accepts shorthand (#rgb) and full forms (#rrggbb, #rrggbbaa).
fromNumber
(val: number, withAlpha?: boolean) => void
Sets the color from a numeric value.

ColorData

ColorData is the serialization format used internally to represent a color in JSON video data.
interface ColorData {
  type: "Color";
  value: {
    a: number; // [0–255]
    r: number; // [0–255]
    g: number; // [0–255]
    b: number; // [0–255]
  };
}