Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/colormath/src/utils.ts>rgbToHex

A color conversion and color manipulation library written in typescript for Node.js, Deno and Browser 🎨.
Latest
function rgbToHex
import { rgbToHex } from "https://deno.land/x/colormath@1.2.4/src/utils.ts";

Converts a rgb array to a formatted hex.

Examples

rgbToHex([255, 255, 255]); // '#ffffff' rgbToHex([0, 0, 0]); // '#000000' rgbToHex([255, 255, 255, 0.5]) // '#ffffff7f'

Parameters

unnamed 0: number[]

The [r, g, b, a] array.

Returns

string