Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/colormath/src/utils.ts>hexToRgb

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

Converts an unformatted hex string to [r, g, b].

Examples

hexToRgb('fff'); // [255, 255, 255] hexToRgb('#000000'); // [0, 0, 0] hexToRgb('#ffffff7f'); // [255, 255, 255, 0.5]

Parameters

hex: string

The Hex