rgb24

import { rgb24 } from "jsr:@ende/fmt/colors";

function

function rgb24(str: string, color: number | Rgb): string

Set text color using 24bit rgb. color can be a number in range 0x000000 to 0xffffff or an Rgb.

str: string

The text to color

color: number | Rgb

The color code

Returns

The text with 24bit rgb color

Example: Usage

import { rgb24 } from "@ende/fmt/colors";

rgb24("foo", 0xff00ff);
rgb24("foo", {r: 255, g: 0, b: 255});

Source