From 224771b34e71f9ca16e87e49d489a994ad138a40 Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 7 Jan 2018 20:02:58 +0300 Subject: [PATCH] reduce colorpicker alpha digits to 3 from 6 --- vendor-overwrites/colorpicker/colorconverter.js | 6 +++++- vendor-overwrites/colorpicker/colorpicker.css | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/vendor-overwrites/colorpicker/colorconverter.js b/vendor-overwrites/colorpicker/colorconverter.js index 45808ff1..ad206239 100644 --- a/vendor-overwrites/colorpicker/colorconverter.js +++ b/vendor-overwrites/colorpicker/colorconverter.js @@ -12,6 +12,7 @@ const colorConverter = (() => { HSVtoHSL, constrainHue, snapToInt, + ALPHA_DIGITS: 3, // NAMED_COLORS is added below }; @@ -87,7 +88,10 @@ const colorConverter = (() => { function formatAlpha(a) { return isNaN(a) ? '' : - (a + .5e-6).toFixed(7).slice(0, -1).replace(/^0(?=\.[1-9])|^1\.0+?$|\.?0+$/g, ''); + (a + .5 * Math.pow(10, -colorConverter.ALPHA_DIGITS)) + .toFixed(colorConverter.ALPHA_DIGITS + 1) + .slice(0, -1) + .replace(/^0(?=\.[1-9])|^1\.0+?$|\.?0+$/g, ''); } function RGBtoHSV({r, g, b, a}) { diff --git a/vendor-overwrites/colorpicker/colorpicker.css b/vendor-overwrites/colorpicker/colorpicker.css index f3cb9b26..f9eecd60 100644 --- a/vendor-overwrites/colorpicker/colorpicker.css +++ b/vendor-overwrites/colorpicker/colorpicker.css @@ -87,7 +87,7 @@ .colorpicker-popup { --switcher-width: 30px; position: relative; - width: 350px; + width: 325px; z-index: 1000; transition: opacity .5s; color: var(--label-color); @@ -277,7 +277,7 @@ } .colorpicker-input-field[class$="-a"] { - flex-grow: 1.5; + flex-grow: 1.25; } .colorpicker-hsl-h::before {