reduce colorpicker alpha digits to 3 from 6
This commit is contained in:
parent
80ad6418aa
commit
224771b34e
|
@ -12,6 +12,7 @@ const colorConverter = (() => {
|
||||||
HSVtoHSL,
|
HSVtoHSL,
|
||||||
constrainHue,
|
constrainHue,
|
||||||
snapToInt,
|
snapToInt,
|
||||||
|
ALPHA_DIGITS: 3,
|
||||||
// NAMED_COLORS is added below
|
// NAMED_COLORS is added below
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,7 +88,10 @@ const colorConverter = (() => {
|
||||||
|
|
||||||
function formatAlpha(a) {
|
function formatAlpha(a) {
|
||||||
return isNaN(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}) {
|
function RGBtoHSV({r, g, b, a}) {
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
.colorpicker-popup {
|
.colorpicker-popup {
|
||||||
--switcher-width: 30px;
|
--switcher-width: 30px;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 350px;
|
width: 325px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
transition: opacity .5s;
|
transition: opacity .5s;
|
||||||
color: var(--label-color);
|
color: var(--label-color);
|
||||||
|
@ -277,7 +277,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.colorpicker-input-field[class$="-a"] {
|
.colorpicker-input-field[class$="-a"] {
|
||||||
flex-grow: 1.5;
|
flex-grow: 1.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
.colorpicker-hsl-h::before {
|
.colorpicker-hsl-h::before {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user