@flourish/utils-color

1.0.2 • Public • Published

flourish-utils-color

hexToColor(hex_string, opacity)

Converts hex to d3 color object as described here

hexToColor("#00ff00", 0.5); // {r: 0, g: 255, b: 0, a: 0.5}

hexToRgba(hex_string, opacity)

Converts hex to rgba string

hexToRgba("#00ff00", 0.5); // rgba(0, 255, 0, 0.5)

isPaleBackground(background_color)

Returns if color is pale or not as a background color, according to APCA color contrast checking.

isPaleText(text_color)

Returns if color is pale or not as a text color, according to APCA color contrast checking.

Readme

Keywords

none

Package Sidebar

Install

npm i @flourish/utils-color

Weekly Downloads

2

Version

1.0.2

License

LicenseRef-LICENSE

Unpacked Size

37.9 kB

Total Files

17

Last publish

Collaborators

  • jontyt
  • rushlet
  • winna_canva
  • bruno-riddy
  • libruca
  • jwitcombe
  • katietannercanva
  • b3n-canva
  • caletilford
  • florin.oprina
  • robinhouston
  • duncanclark
  • daanlouter
  • hughsk
  • mark-kiln
  • animateddata
  • larsvers
  • luptilu
  • bobbysebolao
  • hrobertson
  • oampo