Hex To P3
Utility for converting hexadecimal color strings to P3 color strings.
Installation
# yarn yarn add hex-to-p3 # npm npm i hex-to-p3
Usage
const p3Color = // => color(display-p3 0.30 0.95 0.05 / 1) || #4df20c const forcedP3 = // => 'color(display-p3 0.30 0.95 0.05 / 1)'
API
hex
: The hex color string to convert. If the runtime environmenthexToP3
is called can support P3 colors, it will convert the hex string. Otherwise, it will just return the provided hex string.options
: Options to pass.force
: Iftrue
,hexToP3
will always return the P3 conversion. If explicitly set tofalse
,hexToP3
will always return the hex color.
License
MIT.