Skip to main content

@std/fmt@1.0.6
Built and signed on GitHub Actions

Utilities for formatting values, such as adding colors to text, formatting durations, printf utils, formatting byte numbers.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 months ago (1.0.6)

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

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

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

Examples

To produce the color magenta:

import { bgRgb24 } from "@std/fmt/colors";

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

Parameters

The text color to apply 24bit rgb to

color: number | Rgb

The color code

Return Type

The text with 24bit rgb color

Add Package

deno add jsr:@std/fmt

Import symbol

import { bgRgb24 } from "@std/fmt/colors";

---- OR ----

Import directly with a jsr specifier

import { bgRgb24 } from "jsr:@std/fmt/colors";

Add Package

npx jsr add @std/fmt

Import symbol

import { bgRgb24 } from "@std/fmt/colors";

Add Package

yarn dlx jsr add @std/fmt

Import symbol

import { bgRgb24 } from "@std/fmt/colors";

Add Package

pnpm dlx jsr add @std/fmt

Import symbol

import { bgRgb24 } from "@std/fmt/colors";

Add Package

bunx jsr add @std/fmt

Import symbol

import { bgRgb24 } from "@std/fmt/colors";