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

x/netzo/deps/@unocss/preset-mini/utils.ts>parseColor

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function parseColor
import { parseColor } from "https://deno.land/x/netzo@0.4.62/deps/@unocss/preset-mini/utils.ts";

Parse color string into ParsedColorValue (if possible). Color value will first be matched to theme object before parsing. See also color.tests.ts for more examples.

Examples

Parseable strings: 'red' // From theme, if 'red' is available 'red-100' // From theme, plus scale 'red-100/20' // From theme, plus scale/opacity '[rgb(100 2 3)]/[var(--op)]' // Bracket with rgb color and bracket with opacity

Parameters

body: string
  • Color string to be parsed.
theme: Theme
  • Theme object.
optional
key: ThemeColorKeys

Returns

ParsedColorValue | undefined

object if string is parseable.