stuff
This commit is contained in:
parent
154d2f2328
commit
879c336207
File diff suppressed because one or more lines are too long
|
@ -2268,19 +2268,27 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
function processHSL(comp) {let h = parseFloat(comp.shift().toString().replace(/[^0-9\.\-]/g, ''));h = isNaN(h) || h > 360 ? 360 : h < 0 ? 0 : h;return [h].concat(comp.map(sl => {return processSL(sl);}));};
|
function processHSL(comp) {let h = parseFloat(comp.shift().toString().replace(/[^0-9\.\-]/g, ''));h = isNaN(h) || h > 360 ? 360 : h < 0 ? 0 : h;return [h].concat(comp.map(sl => {return processSL(sl);}));};
|
||||||
};
|
};
|
||||||
|
|
||||||
BDFDB.colorSETALPHA = function (color, a, conv) {
|
var setAlpha = (color, a, conv) => {
|
||||||
var rgbcomp = BDFDB.colorCONVERT(color, 'RGBCOMP');
|
var comp = BDFDB.colorCONVERT(color, 'RGBCOMP');
|
||||||
if (rgbcomp) {
|
if (comp) {
|
||||||
a = a.toString();
|
a = a.toString();
|
||||||
a = (a.indexOf('%') > -1 ? 0.01 : 1) * parseFloat(a.replace(/[^0-9\.\-]/g, ''));
|
a = (a.indexOf('%') > -1 ? 0.01 : 1) * parseFloat(a.replace(/[^0-9\.\-]/g, ''));
|
||||||
a = isNaN(a) || a > 1 ? 1 : a < 0 ? 0 : a;
|
a = isNaN(a) || a > 1 ? 1 : a < 0 ? 0 : a;
|
||||||
rgbcomp[3] = a;
|
comp[3] = a;
|
||||||
conv = (conv || BDFDB.colorTYPE(color)).toUpperCase();
|
conv = (conv || BDFDB.colorTYPE(color)).toUpperCase();
|
||||||
conv = conv == 'HSL' || conv == 'RGB' ? conv + 'A' : conv;
|
conv = conv == 'HSL' || conv == 'RGB' ? conv + 'A' : conv;
|
||||||
return BDFDB.colorCONVERT(rgbcomp, conv);
|
return BDFDB.colorCONVERT(comp, conv);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
BDFDB.colorSETALPHA = function (color, a, conv) {
|
||||||
|
if (BDFDB.isObject(color)) {
|
||||||
|
var newcolor = {};
|
||||||
|
for (let pos in color) newcolor[pos] = setAlpha(color[pos], a, conv);
|
||||||
|
return newcolor;
|
||||||
|
}
|
||||||
|
else return setAlpha(color, a, conv);
|
||||||
|
};
|
||||||
|
|
||||||
var colorChange = (color, value, conv) => {
|
var colorChange = (color, value, conv) => {
|
||||||
var comp = BDFDB.colorCONVERT(color, 'RGBCOMP');
|
var comp = BDFDB.colorCONVERT(color, 'RGBCOMP');
|
||||||
|
@ -2357,7 +2365,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
BDFDB.colorGRADIENT = function (colorobj, direction = 'to right') {
|
BDFDB.colorGRADIENT = function (colorobj, direction = 'to right') {
|
||||||
var sortedgradient = {};
|
var sortedgradient = {};
|
||||||
var gradientstring = 'linear-gradient(' + direction;
|
var gradientstring = 'linear-gradient(' + direction;
|
||||||
for (let pos of Object.keys(colorobj).sort()) gradientstring += `, ${BDFDB.colorCONVERT(colorobj[pos], 'HEX')} ${pos*100}%`
|
for (let pos of Object.keys(colorobj).sort()) gradientstring += `, ${colorobj[pos]} ${pos*100}%`
|
||||||
return gradientstring += ")";
|
return gradientstring += ")";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue