Reference · Backgrounds for a bracket
parseColorfunction
Reads a colour written as #rgb, #rrggbb or rgb(…).
Import it
import { parseColor } from "@johnmorrisdotca/taisen-brackets/backgrounds";
Definition
function parseColor(text: string): ReturnType<typeof shared.parseColor>
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The colour as text. |
Returns
Rgb | null
The red, green and blue, 0 to 255; null when the text is not a colour.
Examples
import { parseColor } from "@johnmorrisdotca/taisen-brackets/backgrounds";
console.log(parseColor("#2f5d4a"), parseColor("not a colour"));[ 47, 93, 74 ] nullWhat it prints (run when this page was built)