JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 315707
  • Score
    100M100P100Q196220F
  • License ISC

Convert colors between RGBA/HSLA/Hex

Package Exports

  • @sphinxxxx/color-conversion

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sphinxxxx/color-conversion) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

color-conversion

JavaScript library for color conversion and manipulation with support for CSS color strings.

Demo: https://rawgit.com/Sphinxxxx/color-conversion/master/demo/index.html

Usage

<script src="https://unpkg.com/@sphinxxxx/color-conversion@2.0.0-alpha.3"></script>

<script>
    //rgba/hsla/hex strings, or rgba array:
    var color = new Color('rgb(200, 250, 0)');
    
    color.hsla;  // [0.2, 1, 0.49, 1]
    color.rgba;  // [200, 250, 0, 1]
    
    color.hslaString;  // "hsla(72,100%,49.02%,1)"
    color.rgbaString;  // "rgba(200,250,0,1)"
    color.hex;         // "#c8fa00ff"
</script>