UNPKG

set_el_theme

Version:

element-ui-plus主题自定义

249 lines 10.4 kB
const _0x11b1 = [ 'map', 'debug', '--el-color-white', '--el-text-color-secondary', '-dark-', 'table', 'info', '--el-fill-color-dark', '--el-color-', '--el-text-color-regular', '--el-color-black', 'substring', 'exception', 'error', '#e6a23c', 'length', 'warn', '-light-', '--el-fill-color-blank', 'toString', '--el-bg-color', '--el-fill-color-extra-light', '#000', '--el-border-color-light', '--el-bg-color-overlay', '#67c23a', '#409eff', 'style', 'themeColor', 'console', '--el-text-color-primary', 'documentElement', 'return\x20(function()\x20', 'keys', '#000000', 'slice', '--el-fill-color-darker', '{}.constructor(\x22return\x20this\x22)(\x20)', '#909399', 'max', '--el-bg-color-page', 'round', '#fff', '--el-fill-color-light', 'log', 'darkColor', '#ffffff', 'brightColor', '--el-fill-color-lighter', 'setProperty', '--el-text-color-placeholder', 'trace', '--el-border-color-lighter', '$1$1', 'min', '#f56c6c', 'apply' ]; (function (_0x531ce2, _0x11b1eb) { const _0x474323 = function (_0x417982) { while (--_0x417982) { _0x531ce2['push'](_0x531ce2['shift']()); } }; _0x474323(++_0x11b1eb); }(_0x11b1, 0x1c1)); const _0x4743 = function (_0x531ce2, _0x11b1eb) { _0x531ce2 = _0x531ce2 - 0x0; let _0x474323 = _0x11b1[_0x531ce2]; return _0x474323; }; const _0x41f037 = function () { let _0x42aea9 = !![]; return function (_0x490cc6, _0x3ec6a1) { const _0x370cae = _0x42aea9 ? function () { if (_0x3ec6a1) { const _0x4e4c74 = _0x3ec6a1[_0x4743('0x6')](_0x490cc6, arguments); _0x3ec6a1 = null; return _0x4e4c74; } } : function () { }; _0x42aea9 = ![]; return _0x370cae; }; }(); const _0x57ed94 = _0x41f037(this, function () { const _0x10206f = function () { }; let _0x5af675; try { const _0x2cfac3 = Function(_0x4743('0x27') + _0x4743('0x2c') + ');'); _0x5af675 = _0x2cfac3(); } catch (_0x2c19e6) { _0x5af675 = window; } if (!_0x5af675[_0x4743('0x24')]) { _0x5af675[_0x4743('0x24')] = function (_0xbc8da1) { const _0x46a9ff = {}; _0x46a9ff[_0x4743('0x33')] = _0xbc8da1; _0x46a9ff[_0x4743('0x17')] = _0xbc8da1; _0x46a9ff[_0x4743('0x8')] = _0xbc8da1; _0x46a9ff['info'] = _0xbc8da1; _0x46a9ff[_0x4743('0x14')] = _0xbc8da1; _0x46a9ff['exception'] = _0xbc8da1; _0x46a9ff[_0x4743('0xc')] = _0xbc8da1; _0x46a9ff['trace'] = _0xbc8da1; return _0x46a9ff; }(_0x10206f); } else { _0x5af675[_0x4743('0x24')][_0x4743('0x33')] = _0x10206f; _0x5af675[_0x4743('0x24')][_0x4743('0x17')] = _0x10206f; _0x5af675['console'][_0x4743('0x8')] = _0x10206f; _0x5af675[_0x4743('0x24')][_0x4743('0xd')] = _0x10206f; _0x5af675['console']['error'] = _0x10206f; _0x5af675['console'][_0x4743('0x13')] = _0x10206f; _0x5af675['console'][_0x4743('0xc')] = _0x10206f; _0x5af675[_0x4743('0x24')][_0x4743('0x1')] = _0x10206f; } }); _0x57ed94(); export function hexToRgb(_0x133504) { var _0xd5905e = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/; var _0x157075 = _0x133504['toLowerCase'](); var _0x512af9 = ''; if (_0xd5905e['test'](_0x157075)) { if (_0x157075[_0x4743('0x16')] === 0x4) { var _0x1dfb5a = '#'; for (var _0x37578a = 0x1; _0x37578a < 0x4; _0x37578a += 0x1) { _0x1dfb5a += _0x157075[_0x4743('0x2a')](_0x37578a, _0x37578a + 0x1)['concat'](_0x157075[_0x4743('0x2a')](_0x37578a, _0x37578a + 0x1)); } _0x157075 = _0x1dfb5a; } var _0x4bcc35 = []; for (var _0x37578a = 0x1; _0x37578a < 0x7; _0x37578a += 0x2) { _0x4bcc35['push'](parseInt('0x' + _0x157075['slice'](_0x37578a, _0x37578a + 0x2))); } var _0x5ddcc5 = _0x4bcc35[0x0] * 0.299 + _0x4bcc35[0x1] * 0.587 + _0x4bcc35[0x2] * 0.114; if (_0x5ddcc5 >= 0xc0) { _0x512af9 = _0x4743('0x1d'); } else { _0x512af9 = '#fff'; } } return _0x512af9; } export function colorToLen(_0x600aa9) { _0x600aa9 = _0x600aa9['substr'](0x1); if (_0x600aa9['length'] === 0x3) { _0x600aa9 = _0x600aa9['replace'](/(.)/g, _0x4743('0x3')); } return '#' + _0x600aa9; } export const colorMix = (_0x1a4a57, _0x200062, _0x1fd5a5) => { _0x1a4a57 = colorToLen(_0x1a4a57); _0x200062 = colorToLen(_0x200062); _0x1fd5a5 = Math[_0x4743('0x2e')](Math[_0x4743('0x4')](Number(_0x1fd5a5), 0x1), 0x0); let _0x2b9415 = parseInt(_0x1a4a57[_0x4743('0x12')](0x1, 0x3), 0x10); let _0x361a51 = parseInt(_0x1a4a57[_0x4743('0x12')](0x3, 0x5), 0x10); let _0x3274bf = parseInt(_0x1a4a57['substring'](0x5, 0x7), 0x10); let _0x50294a = parseInt(_0x200062[_0x4743('0x12')](0x1, 0x3), 0x10); let _0x39ed8a = parseInt(_0x200062[_0x4743('0x12')](0x3, 0x5), 0x10); let _0x332159 = parseInt(_0x200062[_0x4743('0x12')](0x5, 0x7), 0x10); let _0x80442d = Math[_0x4743('0x30')](_0x2b9415 * (0x1 - _0x1fd5a5) + _0x50294a * _0x1fd5a5); let _0x17ee7e = Math[_0x4743('0x30')](_0x361a51 * (0x1 - _0x1fd5a5) + _0x39ed8a * _0x1fd5a5); let _0x3f7ccc = Math[_0x4743('0x30')](_0x3274bf * (0x1 - _0x1fd5a5) + _0x332159 * _0x1fd5a5); _0x80442d = ('0' + (_0x80442d || 0x0)[_0x4743('0x1a')](0x10))[_0x4743('0x2a')](-0x2); _0x17ee7e = ('0' + (_0x17ee7e || 0x0)[_0x4743('0x1a')](0x10))[_0x4743('0x2a')](-0x2); _0x3f7ccc = ('0' + (_0x3f7ccc || 0x0)[_0x4743('0x1a')](0x10))[_0x4743('0x2a')](-0x2); return '#' + _0x80442d + _0x17ee7e + _0x3f7ccc; }; export function setTheColorScale(_0x1d157c, _0x2969de = _0x4743('0x21'), _0x48d773 = _0x4743('0x35'), _0x35aca8 = _0x4743('0x29'), _0x44992b = _0x4743('0x1d')) { let _0x3e1e60 = { 'primary': _0x4743('0x21'), 'success': _0x4743('0x20'), 'warning': _0x4743('0x15'), 'danger': _0x4743('0x5'), 'error': _0x4743('0x5'), 'info': _0x4743('0x2d') }; _0x1d157c[_0x4743('0x9')] = _0x48d773; _0x1d157c[_0x4743('0x11')] = _0x35aca8; _0x1d157c['--el-color-primary'] = _0x2969de; _0x1d157c[_0x4743('0x1b')] = _0x48d773; _0x1d157c[_0x4743('0x1f')] = _0x48d773; _0x1d157c[_0x4743('0x2f')] = colorMix(_0x48d773, _0x2969de, 0.2); if (_0x44992b == _0x4743('0x1d')) { _0x1d157c[_0x4743('0x25')] = colorMix(_0x4743('0x29'), '#ffffff', 0.2); _0x1d157c[_0x4743('0x10')] = colorMix('#000000', _0x4743('0x35'), 0.3); _0x1d157c[_0x4743('0xa')] = colorMix('#000000', _0x4743('0x35'), 0.4); _0x1d157c[_0x4743('0x0')] = colorMix(_0x4743('0x29'), _0x4743('0x35'), 0.5); } else if (_0x44992b == _0x4743('0x31')) { _0x1d157c[_0x4743('0x25')] = colorMix(_0x4743('0x35'), _0x4743('0x29'), 0.2); _0x1d157c[_0x4743('0x10')] = colorMix(_0x4743('0x35'), _0x4743('0x29'), 0.3); _0x1d157c[_0x4743('0xa')] = colorMix('#ffffff', _0x4743('0x29'), 0.4); _0x1d157c[_0x4743('0x0')] = colorMix(_0x4743('0x35'), _0x4743('0x29'), 0.5); } else { _0x1d157c[_0x4743('0x25')] = _0x44992b; _0x1d157c[_0x4743('0x10')] = _0x44992b; _0x1d157c[_0x4743('0xa')] = _0x44992b; _0x1d157c[_0x4743('0x0')] = _0x44992b; } _0x1d157c['--el-border-color'] = colorMix(_0x48d773, _0x2969de, 0.8); _0x1d157c[_0x4743('0x1e')] = colorMix(_0x48d773, _0x2969de, 0.6); _0x1d157c[_0x4743('0x2')] = colorMix(_0x48d773, _0x2969de, 0.4); _0x1d157c['--el-border-color-extra-light'] = colorMix(_0x48d773, _0x2969de, 0.2); _0x1d157c['--el-fill-color'] = colorMix(_0x48d773, _0x2969de, 0.1); _0x1d157c[_0x4743('0x32')] = _0x48d773; _0x1d157c[_0x4743('0x37')] = _0x48d773; _0x1d157c[_0x4743('0x1c')] = _0x48d773; _0x1d157c[_0x4743('0xe')] = _0x48d773; _0x1d157c[_0x4743('0x2b')] = _0x48d773; _0x1d157c[_0x4743('0x19')] = _0x48d773; const _0x1c70d5 = _0x4743('0xf'); Object['keys'](_0x3e1e60)[_0x4743('0x7')](_0x591eac => { for (let _0x19ef86 = 0x1; _0x19ef86 < 0xa; _0x19ef86 += 0x1) { if (_0x19ef86 === 0x2) { _0x1d157c['' + _0x1c70d5 + _0x591eac + _0x4743('0xb') + _0x19ef86] = colorMix(_0x35aca8, _0x3e1e60[_0x591eac], 0x1); } else { _0x1d157c['' + _0x1c70d5 + _0x591eac + _0x4743('0x18') + (0xa - _0x19ef86)] = colorMix(_0x48d773, _0x3e1e60[_0x591eac], _0x19ef86 * 0.1); } } }); } export function setTheme(_0x4b5dce = _0x4743('0x21'), _0x16c422 = _0x4743('0x31'), _0x458660 = _0x4743('0x1d')) { if (_0x458660 == '') { _0x458660 = colorMix(_0x4743('0x1d'), _0x16c422, 0.1); } let _0xd9baeb = hexToRgb(_0x16c422); let _0x50bad0 = {}; const _0x185ce8 = document[_0x4743('0x26')]; setTheColorScale(_0x50bad0, _0x4b5dce, _0x16c422, _0x458660, _0xd9baeb); Object[_0x4743('0x28')](_0x50bad0)['map'](_0x474046 => { _0x185ce8[_0x4743('0x22')]['setProperty'](_0x474046, _0x50bad0[_0x474046]); }); } export function setThemeData(_0x4589e7 = {}) { _0x4589e7[_0x4743('0x23')] = _0x4589e7['themeColor'] ? _0x4589e7['themeColor'] : _0x4743('0x21'); _0x4589e7[_0x4743('0x36')] = _0x4589e7[_0x4743('0x36')] ? _0x4589e7[_0x4743('0x36')] : _0x4743('0x31'); _0x4589e7[_0x4743('0x34')] = _0x4589e7[_0x4743('0x34')] ? _0x4589e7[_0x4743('0x34')] : colorMix(_0x4743('0x1d'), _0x4589e7['brightColor'], 0.1); let _0x40855f = hexToRgb(_0x4589e7[_0x4743('0x36')]); let _0x486500 = {}; const _0x3f355e = document[_0x4743('0x26')]; setTheColorScale(_0x486500, _0x4589e7['themeColor'], _0x4589e7[_0x4743('0x36')], _0x4589e7[_0x4743('0x34')], _0x40855f); Object[_0x4743('0x28')](_0x486500)[_0x4743('0x7')](_0x2e7e95 => { _0x3f355e['style'][_0x4743('0x38')](_0x2e7e95, _0x486500[_0x2e7e95]); }); }