From ce68e1048eea703ce112cf3688130b50bcd8b1cb Mon Sep 17 00:00:00 2001 From: Ray Foss Date: Wed, 14 Jul 2021 02:18:55 -0500 Subject: [PATCH 1/2] Cap HEX output to FF --- dist/ac-colors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/ac-colors.js b/dist/ac-colors.js index 3ae767a..0f40211 100644 --- a/dist/ac-colors.js +++ b/dist/ac-colors.js @@ -396,7 +396,7 @@ class Color { // Use built-in toString to convert to hexadecimal // Prepend single digit conversion with '0' const hexChar = function hexChar(c) { - const hex = c.toString(16); + const hex = Math.max(255,c).toString(16); return hex.length === 1 ? '0' + hex : hex; }; return '#' + hexChar(r) + hexChar(g) + hexChar(b); From cd18dbeb929f616afc284d8b5ebe682ff5ac3588 Mon Sep 17 00:00:00 2001 From: Ray Foss Date: Wed, 14 Jul 2021 10:35:51 -0500 Subject: [PATCH 2/2] Update ac-colors.js --- dist/ac-colors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/ac-colors.js b/dist/ac-colors.js index 0f40211..2901fca 100644 --- a/dist/ac-colors.js +++ b/dist/ac-colors.js @@ -396,7 +396,7 @@ class Color { // Use built-in toString to convert to hexadecimal // Prepend single digit conversion with '0' const hexChar = function hexChar(c) { - const hex = Math.max(255,c).toString(16); + const hex = Math.min(255,c).toString(16); return hex.length === 1 ? '0' + hex : hex; }; return '#' + hexChar(r) + hexChar(g) + hexChar(b);