Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/flow-flo.../js
File: tinycolor.js
// TinyColor v0.9.16
[0] Fix | Delete
// https://github.com/bgrins/TinyColor
[1] Fix | Delete
// 2013-08-10, Brian Grinstead, MIT License
[2] Fix | Delete
[3] Fix | Delete
(function() {
[4] Fix | Delete
[5] Fix | Delete
var trimLeft = /^[\s,#]+/,
[6] Fix | Delete
trimRight = /\s+$/,
[7] Fix | Delete
tinyCounter = 0,
[8] Fix | Delete
math = Math,
[9] Fix | Delete
mathRound = math.round,
[10] Fix | Delete
mathMin = math.min,
[11] Fix | Delete
mathMax = math.max,
[12] Fix | Delete
mathRandom = math.random;
[13] Fix | Delete
[14] Fix | Delete
function tinycolor (color, opts) {
[15] Fix | Delete
[16] Fix | Delete
color = (color) ? color : '';
[17] Fix | Delete
opts = opts || { };
[18] Fix | Delete
[19] Fix | Delete
// If input is already a tinycolor, return itself
[20] Fix | Delete
if (typeof color == "object" && color.hasOwnProperty("_tc_id")) {
[21] Fix | Delete
return color;
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
var rgb = inputToRGB(color);
[25] Fix | Delete
var r = rgb.r,
[26] Fix | Delete
g = rgb.g,
[27] Fix | Delete
b = rgb.b,
[28] Fix | Delete
a = rgb.a,
[29] Fix | Delete
roundA = mathRound(100*a) / 100,
[30] Fix | Delete
format = opts.format || rgb.format;
[31] Fix | Delete
[32] Fix | Delete
// Don't let the range of [0,255] come back in [0,1].
[33] Fix | Delete
// Potentially lose a little bit of precision here, but will fix issues where
[34] Fix | Delete
// .5 gets interpreted as half of the total, instead of half of 1
[35] Fix | Delete
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
[36] Fix | Delete
if (r < 1) { r = mathRound(r); }
[37] Fix | Delete
if (g < 1) { g = mathRound(g); }
[38] Fix | Delete
if (b < 1) { b = mathRound(b); }
[39] Fix | Delete
[40] Fix | Delete
return {
[41] Fix | Delete
ok: rgb.ok,
[42] Fix | Delete
format: format,
[43] Fix | Delete
_tc_id: tinyCounter++,
[44] Fix | Delete
alpha: a,
[45] Fix | Delete
getAlpha: function() {
[46] Fix | Delete
return a;
[47] Fix | Delete
},
[48] Fix | Delete
setAlpha: function(value) {
[49] Fix | Delete
a = boundAlpha(value);
[50] Fix | Delete
roundA = mathRound(100*a) / 100;
[51] Fix | Delete
},
[52] Fix | Delete
toHsv: function() {
[53] Fix | Delete
var hsv = rgbToHsv(r, g, b);
[54] Fix | Delete
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: a };
[55] Fix | Delete
},
[56] Fix | Delete
toHsvString: function() {
[57] Fix | Delete
var hsv = rgbToHsv(r, g, b);
[58] Fix | Delete
var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
[59] Fix | Delete
return (a == 1) ?
[60] Fix | Delete
"hsv(" + h + ", " + s + "%, " + v + "%)" :
[61] Fix | Delete
"hsva(" + h + ", " + s + "%, " + v + "%, "+ roundA + ")";
[62] Fix | Delete
},
[63] Fix | Delete
toHsl: function() {
[64] Fix | Delete
var hsl = rgbToHsl(r, g, b);
[65] Fix | Delete
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: a };
[66] Fix | Delete
},
[67] Fix | Delete
toHslString: function() {
[68] Fix | Delete
var hsl = rgbToHsl(r, g, b);
[69] Fix | Delete
var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
[70] Fix | Delete
return (a == 1) ?
[71] Fix | Delete
"hsl(" + h + ", " + s + "%, " + l + "%)" :
[72] Fix | Delete
"hsla(" + h + ", " + s + "%, " + l + "%, "+ roundA + ")";
[73] Fix | Delete
},
[74] Fix | Delete
toHex: function(allow3Char) {
[75] Fix | Delete
return rgbToHex(r, g, b, allow3Char);
[76] Fix | Delete
},
[77] Fix | Delete
toHexString: function(allow3Char) {
[78] Fix | Delete
return '#' + rgbToHex(r, g, b, allow3Char);
[79] Fix | Delete
},
[80] Fix | Delete
toRgb: function() {
[81] Fix | Delete
return { r: mathRound(r), g: mathRound(g), b: mathRound(b), a: a };
[82] Fix | Delete
},
[83] Fix | Delete
toRgbString: function() {
[84] Fix | Delete
return (a == 1) ?
[85] Fix | Delete
"rgb(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ")" :
[86] Fix | Delete
"rgba(" + mathRound(r) + ", " + mathRound(g) + ", " + mathRound(b) + ", " + roundA + ")";
[87] Fix | Delete
},
[88] Fix | Delete
toPercentageRgb: function() {
[89] Fix | Delete
return { r: mathRound(bound01(r, 255) * 100) + "%", g: mathRound(bound01(g, 255) * 100) + "%", b: mathRound(bound01(b, 255) * 100) + "%", a: a };
[90] Fix | Delete
},
[91] Fix | Delete
toPercentageRgbString: function() {
[92] Fix | Delete
return (a == 1) ?
[93] Fix | Delete
"rgb(" + mathRound(bound01(r, 255) * 100) + "%, " + mathRound(bound01(g, 255) * 100) + "%, " + mathRound(bound01(b, 255) * 100) + "%)" :
[94] Fix | Delete
"rgba(" + mathRound(bound01(r, 255) * 100) + "%, " + mathRound(bound01(g, 255) * 100) + "%, " + mathRound(bound01(b, 255) * 100) + "%, " + roundA + ")";
[95] Fix | Delete
},
[96] Fix | Delete
toName: function() {
[97] Fix | Delete
if (a === 0) {
[98] Fix | Delete
return "transparent";
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
return hexNames[rgbToHex(r, g, b, true)] || false;
[102] Fix | Delete
},
[103] Fix | Delete
toFilter: function(secondColor) {
[104] Fix | Delete
var hex = rgbToHex(r, g, b);
[105] Fix | Delete
var secondHex = hex;
[106] Fix | Delete
var alphaHex = Math.round(parseFloat(a) * 255).toString(16);
[107] Fix | Delete
var secondAlphaHex = alphaHex;
[108] Fix | Delete
var gradientType = opts && opts.gradientType ? "GradientType = 1, " : "";
[109] Fix | Delete
[110] Fix | Delete
if (secondColor) {
[111] Fix | Delete
var s = tinycolor(secondColor);
[112] Fix | Delete
secondHex = s.toHex();
[113] Fix | Delete
secondAlphaHex = Math.round(parseFloat(s.alpha) * 255).toString(16);
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr=#" + pad2(alphaHex) + hex + ",endColorstr=#" + pad2(secondAlphaHex) + secondHex + ")";
[117] Fix | Delete
},
[118] Fix | Delete
toString: function(format) {
[119] Fix | Delete
var formatSet = !!format;
[120] Fix | Delete
format = format || this.format;
[121] Fix | Delete
[122] Fix | Delete
var formattedString = false;
[123] Fix | Delete
var hasAlphaAndFormatNotSet = !formatSet && a < 1 && a > 0;
[124] Fix | Delete
var formatWithAlpha = hasAlphaAndFormatNotSet && (format === "hex" || format === "hex6" || format === "hex3" || format === "name");
[125] Fix | Delete
[126] Fix | Delete
if (format === "rgb") {
[127] Fix | Delete
formattedString = this.toRgbString();
[128] Fix | Delete
}
[129] Fix | Delete
if (format === "prgb") {
[130] Fix | Delete
formattedString = this.toPercentageRgbString();
[131] Fix | Delete
}
[132] Fix | Delete
if (format === "hex" || format === "hex6") {
[133] Fix | Delete
formattedString = this.toHexString();
[134] Fix | Delete
}
[135] Fix | Delete
if (format === "hex3") {
[136] Fix | Delete
formattedString = this.toHexString(true);
[137] Fix | Delete
}
[138] Fix | Delete
if (format === "name") {
[139] Fix | Delete
formattedString = this.toName();
[140] Fix | Delete
}
[141] Fix | Delete
if (format === "hsl") {
[142] Fix | Delete
formattedString = this.toHslString();
[143] Fix | Delete
}
[144] Fix | Delete
if (format === "hsv") {
[145] Fix | Delete
formattedString = this.toHsvString();
[146] Fix | Delete
}
[147] Fix | Delete
[148] Fix | Delete
if (formatWithAlpha) {
[149] Fix | Delete
return this.toRgbString();
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
return formattedString || this.toHexString();
[153] Fix | Delete
}
[154] Fix | Delete
};
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
// If input is an object, force 1 into "1.0" to handle ratios properly
[158] Fix | Delete
// String input requires "1.0" as input, so 1 will be treated as 1
[159] Fix | Delete
tinycolor.fromRatio = function(color, opts) {
[160] Fix | Delete
if (typeof color == "object") {
[161] Fix | Delete
var newColor = {};
[162] Fix | Delete
for (var i in color) {
[163] Fix | Delete
if (color.hasOwnProperty(i)) {
[164] Fix | Delete
if (i === "a") {
[165] Fix | Delete
newColor[i] = color[i];
[166] Fix | Delete
}
[167] Fix | Delete
else {
[168] Fix | Delete
newColor[i] = convertToPercentage(color[i]);
[169] Fix | Delete
}
[170] Fix | Delete
}
[171] Fix | Delete
}
[172] Fix | Delete
color = newColor;
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
return tinycolor(color, opts);
[176] Fix | Delete
};
[177] Fix | Delete
[178] Fix | Delete
// Given a string or object, convert that input to RGB
[179] Fix | Delete
// Possible string inputs:
[180] Fix | Delete
//
[181] Fix | Delete
// "red"
[182] Fix | Delete
// "#f00" or "f00"
[183] Fix | Delete
// "#ff0000" or "ff0000"
[184] Fix | Delete
// "rgb 255 0 0" or "rgb (255, 0, 0)"
[185] Fix | Delete
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
[186] Fix | Delete
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
[187] Fix | Delete
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
[188] Fix | Delete
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
[189] Fix | Delete
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
[190] Fix | Delete
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
[191] Fix | Delete
//
[192] Fix | Delete
function inputToRGB(color) {
[193] Fix | Delete
[194] Fix | Delete
var rgb = { r: 0, g: 0, b: 0 };
[195] Fix | Delete
var a = 1;
[196] Fix | Delete
var ok = false;
[197] Fix | Delete
var format = false;
[198] Fix | Delete
[199] Fix | Delete
if (typeof color == "string") {
[200] Fix | Delete
color = stringInputToObject(color);
[201] Fix | Delete
}
[202] Fix | Delete
[203] Fix | Delete
if (typeof color == "object") {
[204] Fix | Delete
if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) {
[205] Fix | Delete
rgb = rgbToRgb(color.r, color.g, color.b);
[206] Fix | Delete
ok = true;
[207] Fix | Delete
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
[208] Fix | Delete
}
[209] Fix | Delete
else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) {
[210] Fix | Delete
color.s = convertToPercentage(color.s);
[211] Fix | Delete
color.v = convertToPercentage(color.v);
[212] Fix | Delete
rgb = hsvToRgb(color.h, color.s, color.v);
[213] Fix | Delete
ok = true;
[214] Fix | Delete
format = "hsv";
[215] Fix | Delete
}
[216] Fix | Delete
else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) {
[217] Fix | Delete
color.s = convertToPercentage(color.s);
[218] Fix | Delete
color.l = convertToPercentage(color.l);
[219] Fix | Delete
rgb = hslToRgb(color.h, color.s, color.l);
[220] Fix | Delete
ok = true;
[221] Fix | Delete
format = "hsl";
[222] Fix | Delete
}
[223] Fix | Delete
[224] Fix | Delete
if (color.hasOwnProperty("a")) {
[225] Fix | Delete
a = color.a;
[226] Fix | Delete
}
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
a = boundAlpha(a);
[230] Fix | Delete
[231] Fix | Delete
return {
[232] Fix | Delete
ok: ok,
[233] Fix | Delete
format: color.format || format,
[234] Fix | Delete
r: mathMin(255, mathMax(rgb.r, 0)),
[235] Fix | Delete
g: mathMin(255, mathMax(rgb.g, 0)),
[236] Fix | Delete
b: mathMin(255, mathMax(rgb.b, 0)),
[237] Fix | Delete
a: a
[238] Fix | Delete
};
[239] Fix | Delete
}
[240] Fix | Delete
[241] Fix | Delete
[242] Fix | Delete
// Conversion Functions
[243] Fix | Delete
// --------------------
[244] Fix | Delete
[245] Fix | Delete
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
[246] Fix | Delete
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
[247] Fix | Delete
[248] Fix | Delete
// `rgbToRgb`
[249] Fix | Delete
// Handle bounds / percentage checking to conform to CSS color spec
[250] Fix | Delete
// <http://www.w3.org/TR/css3-color/>
[251] Fix | Delete
// *Assumes:* r, g, b in [0, 255] or [0, 1]
[252] Fix | Delete
// *Returns:* { r, g, b } in [0, 255]
[253] Fix | Delete
function rgbToRgb(r, g, b){
[254] Fix | Delete
return {
[255] Fix | Delete
r: bound01(r, 255) * 255,
[256] Fix | Delete
g: bound01(g, 255) * 255,
[257] Fix | Delete
b: bound01(b, 255) * 255
[258] Fix | Delete
};
[259] Fix | Delete
}
[260] Fix | Delete
[261] Fix | Delete
// `rgbToHsl`
[262] Fix | Delete
// Converts an RGB color value to HSL.
[263] Fix | Delete
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
[264] Fix | Delete
// *Returns:* { h, s, l } in [0,1]
[265] Fix | Delete
function rgbToHsl(r, g, b) {
[266] Fix | Delete
[267] Fix | Delete
r = bound01(r, 255);
[268] Fix | Delete
g = bound01(g, 255);
[269] Fix | Delete
b = bound01(b, 255);
[270] Fix | Delete
[271] Fix | Delete
var max = mathMax(r, g, b), min = mathMin(r, g, b);
[272] Fix | Delete
var h, s, l = (max + min) / 2;
[273] Fix | Delete
[274] Fix | Delete
if(max == min) {
[275] Fix | Delete
h = s = 0; // achromatic
[276] Fix | Delete
}
[277] Fix | Delete
else {
[278] Fix | Delete
var d = max - min;
[279] Fix | Delete
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
[280] Fix | Delete
switch(max) {
[281] Fix | Delete
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
[282] Fix | Delete
case g: h = (b - r) / d + 2; break;
[283] Fix | Delete
case b: h = (r - g) / d + 4; break;
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
h /= 6;
[287] Fix | Delete
}
[288] Fix | Delete
[289] Fix | Delete
return { h: h, s: s, l: l };
[290] Fix | Delete
}
[291] Fix | Delete
[292] Fix | Delete
// `hslToRgb`
[293] Fix | Delete
// Converts an HSL color value to RGB.
[294] Fix | Delete
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
[295] Fix | Delete
// *Returns:* { r, g, b } in the set [0, 255]
[296] Fix | Delete
function hslToRgb(h, s, l) {
[297] Fix | Delete
var r, g, b;
[298] Fix | Delete
[299] Fix | Delete
h = bound01(h, 360);
[300] Fix | Delete
s = bound01(s, 100);
[301] Fix | Delete
l = bound01(l, 100);
[302] Fix | Delete
[303] Fix | Delete
function hue2rgb(p, q, t) {
[304] Fix | Delete
if(t < 0) t += 1;
[305] Fix | Delete
if(t > 1) t -= 1;
[306] Fix | Delete
if(t < 1/6) return p + (q - p) * 6 * t;
[307] Fix | Delete
if(t < 1/2) return q;
[308] Fix | Delete
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
[309] Fix | Delete
return p;
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
if(s === 0) {
[313] Fix | Delete
r = g = b = l; // achromatic
[314] Fix | Delete
}
[315] Fix | Delete
else {
[316] Fix | Delete
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
[317] Fix | Delete
var p = 2 * l - q;
[318] Fix | Delete
r = hue2rgb(p, q, h + 1/3);
[319] Fix | Delete
g = hue2rgb(p, q, h);
[320] Fix | Delete
b = hue2rgb(p, q, h - 1/3);
[321] Fix | Delete
}
[322] Fix | Delete
[323] Fix | Delete
return { r: r * 255, g: g * 255, b: b * 255 };
[324] Fix | Delete
}
[325] Fix | Delete
[326] Fix | Delete
// `rgbToHsv`
[327] Fix | Delete
// Converts an RGB color value to HSV
[328] Fix | Delete
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
[329] Fix | Delete
// *Returns:* { h, s, v } in [0,1]
[330] Fix | Delete
function rgbToHsv(r, g, b) {
[331] Fix | Delete
[332] Fix | Delete
r = bound01(r, 255);
[333] Fix | Delete
g = bound01(g, 255);
[334] Fix | Delete
b = bound01(b, 255);
[335] Fix | Delete
[336] Fix | Delete
var max = mathMax(r, g, b), min = mathMin(r, g, b);
[337] Fix | Delete
var h, s, v = max;
[338] Fix | Delete
[339] Fix | Delete
var d = max - min;
[340] Fix | Delete
s = max === 0 ? 0 : d / max;
[341] Fix | Delete
[342] Fix | Delete
if(max == min) {
[343] Fix | Delete
h = 0; // achromatic
[344] Fix | Delete
}
[345] Fix | Delete
else {
[346] Fix | Delete
switch(max) {
[347] Fix | Delete
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
[348] Fix | Delete
case g: h = (b - r) / d + 2; break;
[349] Fix | Delete
case b: h = (r - g) / d + 4; break;
[350] Fix | Delete
}
[351] Fix | Delete
h /= 6;
[352] Fix | Delete
}
[353] Fix | Delete
return { h: h, s: s, v: v };
[354] Fix | Delete
}
[355] Fix | Delete
[356] Fix | Delete
// `hsvToRgb`
[357] Fix | Delete
// Converts an HSV color value to RGB.
[358] Fix | Delete
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
[359] Fix | Delete
// *Returns:* { r, g, b } in the set [0, 255]
[360] Fix | Delete
function hsvToRgb(h, s, v) {
[361] Fix | Delete
[362] Fix | Delete
h = bound01(h, 360) * 6;
[363] Fix | Delete
s = bound01(s, 100);
[364] Fix | Delete
v = bound01(v, 100);
[365] Fix | Delete
[366] Fix | Delete
var i = math.floor(h),
[367] Fix | Delete
f = h - i,
[368] Fix | Delete
p = v * (1 - s),
[369] Fix | Delete
q = v * (1 - f * s),
[370] Fix | Delete
t = v * (1 - (1 - f) * s),
[371] Fix | Delete
mod = i % 6,
[372] Fix | Delete
r = [v, q, p, p, t, v][mod],
[373] Fix | Delete
g = [t, v, v, q, p, p][mod],
[374] Fix | Delete
b = [p, p, t, v, v, q][mod];
[375] Fix | Delete
[376] Fix | Delete
return { r: r * 255, g: g * 255, b: b * 255 };
[377] Fix | Delete
}
[378] Fix | Delete
[379] Fix | Delete
// `rgbToHex`
[380] Fix | Delete
// Converts an RGB color to hex
[381] Fix | Delete
// Assumes r, g, and b are contained in the set [0, 255]
[382] Fix | Delete
// Returns a 3 or 6 character hex
[383] Fix | Delete
function rgbToHex(r, g, b, allow3Char) {
[384] Fix | Delete
[385] Fix | Delete
var hex = [
[386] Fix | Delete
pad2(mathRound(r).toString(16)),
[387] Fix | Delete
pad2(mathRound(g).toString(16)),
[388] Fix | Delete
pad2(mathRound(b).toString(16))
[389] Fix | Delete
];
[390] Fix | Delete
[391] Fix | Delete
// Return a 3 character hex if possible
[392] Fix | Delete
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
[393] Fix | Delete
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
[394] Fix | Delete
}
[395] Fix | Delete
[396] Fix | Delete
return hex.join("");
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
// `equals`
[400] Fix | Delete
// Can be called with any tinycolor input
[401] Fix | Delete
tinycolor.equals = function (color1, color2) {
[402] Fix | Delete
if (!color1 || !color2) { return false; }
[403] Fix | Delete
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
[404] Fix | Delete
};
[405] Fix | Delete
tinycolor.random = function() {
[406] Fix | Delete
return tinycolor.fromRatio({
[407] Fix | Delete
r: mathRandom(),
[408] Fix | Delete
g: mathRandom(),
[409] Fix | Delete
b: mathRandom()
[410] Fix | Delete
});
[411] Fix | Delete
};
[412] Fix | Delete
[413] Fix | Delete
[414] Fix | Delete
// Modification Functions
[415] Fix | Delete
// ----------------------
[416] Fix | Delete
// Thanks to less.js for some of the basics here
[417] Fix | Delete
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
[418] Fix | Delete
[419] Fix | Delete
tinycolor.desaturate = function (color, amount) {
[420] Fix | Delete
amount = (amount === 0) ? 0 : (amount || 10);
[421] Fix | Delete
var hsl = tinycolor(color).toHsl();
[422] Fix | Delete
hsl.s -= amount / 100;
[423] Fix | Delete
hsl.s = clamp01(hsl.s);
[424] Fix | Delete
return tinycolor(hsl);
[425] Fix | Delete
};
[426] Fix | Delete
tinycolor.saturate = function (color, amount) {
[427] Fix | Delete
amount = (amount === 0) ? 0 : (amount || 10);
[428] Fix | Delete
var hsl = tinycolor(color).toHsl();
[429] Fix | Delete
hsl.s += amount / 100;
[430] Fix | Delete
hsl.s = clamp01(hsl.s);
[431] Fix | Delete
return tinycolor(hsl);
[432] Fix | Delete
};
[433] Fix | Delete
tinycolor.greyscale = function(color) {
[434] Fix | Delete
return tinycolor.desaturate(color, 100);
[435] Fix | Delete
};
[436] Fix | Delete
tinycolor.lighten = function(color, amount) {
[437] Fix | Delete
amount = (amount === 0) ? 0 : (amount || 10);
[438] Fix | Delete
var hsl = tinycolor(color).toHsl();
[439] Fix | Delete
hsl.l += amount / 100;
[440] Fix | Delete
hsl.l = clamp01(hsl.l);
[441] Fix | Delete
return tinycolor(hsl);
[442] Fix | Delete
};
[443] Fix | Delete
tinycolor.darken = function (color, amount) {
[444] Fix | Delete
amount = (amount === 0) ? 0 : (amount || 10);
[445] Fix | Delete
var hsl = tinycolor(color).toHsl();
[446] Fix | Delete
hsl.l -= amount / 100;
[447] Fix | Delete
hsl.l = clamp01(hsl.l);
[448] Fix | Delete
return tinycolor(hsl);
[449] Fix | Delete
};
[450] Fix | Delete
tinycolor.complement = function(color) {
[451] Fix | Delete
var hsl = tinycolor(color).toHsl();
[452] Fix | Delete
hsl.h = (hsl.h + 180) % 360;
[453] Fix | Delete
return tinycolor(hsl);
[454] Fix | Delete
};
[455] Fix | Delete
[456] Fix | Delete
[457] Fix | Delete
// Combination Functions
[458] Fix | Delete
// ---------------------
[459] Fix | Delete
// Thanks to jQuery xColor for some of the ideas behind these
[460] Fix | Delete
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
[461] Fix | Delete
[462] Fix | Delete
tinycolor.triad = function(color) {
[463] Fix | Delete
var hsl = tinycolor(color).toHsl();
[464] Fix | Delete
var h = hsl.h;
[465] Fix | Delete
return [
[466] Fix | Delete
tinycolor(color),
[467] Fix | Delete
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
[468] Fix | Delete
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
[469] Fix | Delete
];
[470] Fix | Delete
};
[471] Fix | Delete
tinycolor.tetrad = function(color) {
[472] Fix | Delete
var hsl = tinycolor(color).toHsl();
[473] Fix | Delete
var h = hsl.h;
[474] Fix | Delete
return [
[475] Fix | Delete
tinycolor(color),
[476] Fix | Delete
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
[477] Fix | Delete
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
[478] Fix | Delete
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
[479] Fix | Delete
];
[480] Fix | Delete
};
[481] Fix | Delete
tinycolor.splitcomplement = function(color) {
[482] Fix | Delete
var hsl = tinycolor(color).toHsl();
[483] Fix | Delete
var h = hsl.h;
[484] Fix | Delete
return [
[485] Fix | Delete
tinycolor(color),
[486] Fix | Delete
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
[487] Fix | Delete
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
[488] Fix | Delete
];
[489] Fix | Delete
};
[490] Fix | Delete
tinycolor.analogous = function(color, results, slices) {
[491] Fix | Delete
results = results || 6;
[492] Fix | Delete
slices = slices || 30;
[493] Fix | Delete
[494] Fix | Delete
var hsl = tinycolor(color).toHsl();
[495] Fix | Delete
var part = 360 / slices;
[496] Fix | Delete
var ret = [tinycolor(color)];
[497] Fix | Delete
[498] Fix | Delete
for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function