Skip to content

textmode.js / color / TextmodeColor / withAlpha

Method: withAlpha() ​

ts
withAlpha(alpha): TextmodeColor;

Create a copy of this color with a different alpha value.

Useful for creating semi-transparent variations of existing colors without manually copying RGB components.

Parameters ​

ParameterTypeDescription
alphanumberThe new alpha value (0-255). Values outside this range will be clamped.

Returns ​

TextmodeColor

A new TextmodeColor instance with the updated alpha.

Example ​