Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

hex-to-p3

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hex-to-p3

Tiny color coverting functions.

latest
Source
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

Hex To P3

Utility for converting hexadecimal color strings to P3 color strings.

npm version

Installation

# yarn
yarn add hex-to-p3

# npm
npm i hex-to-p3

Usage

import hexToP3 from 'hex-to-p3'

const p3Color = hexToP3('#4df20c')
// => color(display-p3 0.30 0.95 0.05 / 1) || #4df20c

const forcedP3 = hexToP3('#4df20c', { force: true })
// => 'color(display-p3 0.30 0.95 0.05 / 1)'

API

hexToP3(hex, options)
  • hex: The hex color string to convert. If the runtime environment hexToP3 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: If true, hexToP3 will always return the P3 conversion. If explicitly set to false, hexToP3 will always return the hex color.

License

MIT.

Keywords

color

FAQs

Package last updated on 29 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts