Skip to main content

Built and signed on GitHub Actions

This is my helper functions

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 (0.2.2)
function cs
cs(
message: string | number,
options?: Option,
): string

Colorize a string

  • List of available colors:
"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white"

Examples

Example 1

import { cs } from './color';

console.log(cs('Hello, World!', { foregroundColor: 'red' }));

Parameters

message: string | number

The message

optional
options: Option

foreground color | background color

Return Type

Return a formated string with color

Add Package

deno add jsr:@pifplif/utils

Import symbol

import { cs } from "@pifplif/utils";

---- OR ----

Import directly with a jsr specifier

import { cs } from "jsr:@pifplif/utils";

Add Package

npx jsr add @pifplif/utils

Import symbol

import { cs } from "@pifplif/utils";

Add Package

yarn dlx jsr add @pifplif/utils

Import symbol

import { cs } from "@pifplif/utils";

Add Package

pnpm dlx jsr add @pifplif/utils

Import symbol

import { cs } from "@pifplif/utils";

Add Package

bunx jsr add @pifplif/utils

Import symbol

import { cs } from "@pifplif/utils";