2016-04-26 17:44:17 +03:00
|
|
|
export const IMAGES_ROOT = 'assets/img/';
|
|
|
|
|
|
2016-05-17 12:45:28 +03:00
|
|
|
export const layoutSizes = {
|
|
|
|
|
resWidthCollapseSidebar: 1200,
|
|
|
|
|
resWidthHideSidebar: 500
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const layoutPaths = {
|
|
|
|
|
images: {
|
|
|
|
|
root: IMAGES_ROOT,
|
|
|
|
|
profile: IMAGES_ROOT + 'app/profile/',
|
|
|
|
|
amMap: 'assets/img/theme/vendor/ammap/',
|
|
|
|
|
amChart: 'assets/img/theme/vendor/amcharts/dist/amcharts/images/'
|
|
|
|
|
}
|
|
|
|
|
};
|
2016-05-03 14:33:28 +03:00
|
|
|
|
2016-05-16 17:08:43 +03:00
|
|
|
export class colorHelper {
|
|
|
|
|
static shade = (color, weight) => {
|
2016-05-17 12:45:28 +03:00
|
|
|
return colorHelper.mix('#000000', color, weight);
|
2016-05-16 17:08:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static tint = (color, weight) => {
|
2016-05-17 12:45:28 +03:00
|
|
|
return colorHelper.mix('#ffffff', color, weight);
|
2016-05-16 17:08:43 +03:00
|
|
|
};
|
2016-05-16 17:53:52 +03:00
|
|
|
|
|
|
|
|
static hexToRgbA = (hex, alpha) => {
|
2016-05-17 12:45:28 +03:00
|
|
|
let c;
|
2016-05-16 17:53:52 +03:00
|
|
|
if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {
|
|
|
|
|
c = hex.substring(1).split('');
|
|
|
|
|
if (c.length == 3) {
|
|
|
|
|
c = [c[0], c[0], c[1], c[1], c[2], c[2]];
|
|
|
|
|
}
|
|
|
|
|
c = '0x' + c.join('');
|
|
|
|
|
return 'rgba(' + [(c >> 16) & 255, (c >> 8) & 255, c & 255].join(',') + ',' + alpha + ')';
|
|
|
|
|
}
|
|
|
|
|
throw new Error('Bad Hex');
|
2016-05-17 12:45:28 +03:00
|
|
|
};
|
2016-05-02 19:49:37 +03:00
|
|
|
|
2016-05-17 12:45:28 +03:00
|
|
|
static mix = (color1, color2, weight) => {
|
2016-05-03 14:33:28 +03:00
|
|
|
|
2016-05-17 12:45:28 +03:00
|
|
|
let d2h = (d) => d.toString(16);
|
|
|
|
|
let h2d = (h) => parseInt(h, 16);
|
2016-05-03 14:33:28 +03:00
|
|
|
|
2016-05-17 12:45:28 +03:00
|
|
|
let result = "#";
|
|
|
|
|
for (let i = 1; i < 7; i += 2) {
|
|
|
|
|
let color1Part = h2d(color1.substr(i, 2));
|
|
|
|
|
let color2Part = h2d(color2.substr(i, 2));
|
|
|
|
|
let resultPart = d2h(Math.floor(color2Part + (color1Part - color2Part) * (weight / 100.0)));
|
|
|
|
|
result += ('0' + resultPart).slice(-2);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
}
|
2016-05-17 14:13:56 +03:00
|
|
|
|
|
|
|
|
export const isMobile = () => (/android|webos|iphone|ipad|ipod|blackberry|windows phone/).test(navigator.userAgent.toLowerCase());
|