@bencevans/color-array-average
Advanced tools
Comparing version
@@ -16,7 +16,7 @@ const averageColor = colors => { | ||
| return '#' + | ||
| Math.round(totalR).toString(16).padEnd(2, '0') + | ||
| Math.round(totalG).toString(16).padEnd(2, '0') + | ||
| Math.round(totalB).toString(16).padEnd(2, '0'); | ||
| Math.round(totalR).toString(16).padStart(2, '0') + | ||
| Math.round(totalG).toString(16).padStart(2, '0') + | ||
| Math.round(totalB).toString(16).padStart(2, '0'); | ||
| }; | ||
| module.exports = averageColor; |
| { | ||
| "name": "@bencevans/color-array-average", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "Calculate the average color given an array of CSS Hex Colors", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,4 +11,5 @@ const test = require('tape'); | ||
| t.equal(averageColor(['#121212', '#121212']), '#121212'); | ||
| t.equal(averageColor(['#ff0000', '#ff0000']), '#ff0000') | ||
| t.equal(averageColor(['#ff0000', '#ff0000']), '#ff0000'); | ||
| t.equal(averageColor(['#030303', '#050505']), '#040404'); | ||
| t.end(); | ||
| }); |
2354
2.93%30
3.45%