Package Exports
- color-mixture
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 (color-mixture) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
color-mixture.js
To mix two color with specified ratio. This is a mirror of hexo/lib/plugins/helper/tagcloud.js.

Install
$ npm install color-mixtureUsage
Define a color
mixture.Color(color_string)
var mixture = require('color-mixture');
// hex
new mixture.Color('#0ff') // Color { r: 0, g: 255, b: 255, a: 1 }
new mixture.Color('#00ffff') // Color { r: 0, g: 255, b: 255, a: 1 }
// rgb
new mixture.Color('rgb(0, 255, 255)') // Color { r: 0, g: 255, b: 255, a: 1 }
// rgba
new mixture.Color('rgba(0, 255, 255, 0.1)') // Color { r: 0, g: 255, b: 255, a: 0.1 }
// hsl
new mixture.Color('hsl(2, 100%, 50%)') // Color { a: 1, r: 255, g: 9, b: 0 }
// hsla
new mixture.Color('hsl(2, 100%, 50%, 0.1)') // Color { a: 0.1, r: 255, g: 9, b: 0 }
// color name
new mixture.Color('red') //Color { r: 255, g: 0, b: 0, a: 1 }Get r,g,b,a of a color
var c = new mixture.Color('red');
c.r //255
c.g //0
c.b //0
c.a //1toString
(new mixture.Color('rgb(0, 255, 255)')).toString() // '#0ff'
(new mixture.Color('rgba(0, 255, 255, 0.1)')).toString() // 'rgba(0, 255, 255, 0.1)'Mix 2 color
color1.mix(color2, ratio)
var color1 = new mixture.Color('#000'); // Color { r: 0, g: 0, b: 0, a: 1 }
var color2 = new mixture.Color('#fff'); // Color { r: 255, g: 255, b: 255, a: 1 }
var mix_color = color1.mix(color2, 0.1); // Color { r: 26, g: 26, b: 26, a: 1 }License
The same license as hexo.