1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-22 09:54:24 +04:00

charts refactor, libs refactor

This commit is contained in:
codecalm
2019-12-18 21:26:31 +01:00
parent e5ea4d1a97
commit 526818e858
23 changed files with 573 additions and 467 deletions

View File

@@ -1,29 +1,4 @@
const tabler = {
colorVariation: function(color, variation) {
const colorValue = this.colors[color];
if (colorValue) {
switch (variation) {
case 'light':
return this.mixColors(colorValue, '#ffffff', 70);
case 'lighten':
return this.mixColors(colorValue, '#ffffff', 30);
case 'lightest':
return this.mixColors(colorValue, '#ffffff', 10);
case 'dark':
return this.mixColors(colorValue, '#000000', 80);
case 'darken':
return this.mixColors(colorValue, '#000000', 40);
case 'darkest':
return this.mixColors(colorValue, '#000000', 20);
}
return colorValue;
}
throw new Error('Wrong color: ' + color);
},
hexToRgbA: function(hex, opacity) {
let c;
@@ -40,40 +15,6 @@ const tabler = {
throw new Error('Bad Hex');
},
mixColors: function(color_1, color_2, weight) {
color_1 = color_1.substr(1);
color_2 = color_2.substr(1);
function d2h(d) {
return d.toString(16);
}
function h2d(h) {
return parseInt(h, 16);
}
weight = typeof weight !== 'undefined' ? weight : 50;
let color = '#';
for (let i = 0; i <= 5; i += 2) {
let v1 = h2d(color_1.substr(i, 2)),
v2 = h2d(color_2.substr(i, 2));
let val = d2h(Math.floor(v2 + (v1 - v2) * (weight / 100.0)));
while (val.length < 2) {
val = '0' + val;
}
color += val;
}
return color;
},
colors: (window.tabler_colors || []),
toggleFullscreen: function(elem) {
elem = elem || document.documentElement;
if (