diff --git a/src/sources/rgba.js b/src/sources/rgba.js index 3ba3670..b8d8552 100644 --- a/src/sources/rgba.js +++ b/src/sources/rgba.js @@ -54,7 +54,7 @@ function toHex(rgba) { ]; if (rgba.a < 1) { - hexList.push(round(rgba.a)); + hexList.push(toString16(round(rgba.a * 255))); } return '#' + hexList.join(''); diff --git a/test/sources/test.rgba.js b/test/sources/test.rgba.js index fc65fbb..fce6c26 100644 --- a/test/sources/test.rgba.js +++ b/test/sources/test.rgba.js @@ -45,11 +45,11 @@ describe('rgba', function () { a: 1 })).toEqual('#01167b'); expect(rgba.toHex({ - r: 90, - g: 12, - b: 311, - a: 0.6 - })).toEqual('#5a0c1371'); + r: 1, + g: 3, + b: 5, + a: 0.7 + })).toEqual('#010305b3'); }); it('.toHsl', function () {