reduce colorpicker alpha digits to 3 from 6

This commit is contained in:
tophf 2018-01-07 20:02:58 +03:00
parent 80ad6418aa
commit 224771b34e
2 changed files with 7 additions and 3 deletions

View File

@ -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}) {

View File

@ -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 {