🌷第一步 在js文件中写入你需要的颜色 这里的颜色也可以写渐变的
🌷第一步 在js文件中写入你需要的颜色 这里的颜色也可以写渐变的
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'echarts'], factory);
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
factory(exports, require('echarts'));
} else {
factory({}, root.echarts);
}
}(this, function (exports, echarts) {
var log = function (msg) {
if (typeof console !== 'undefined') {
console && console.error && console.error(msg);
}
};
if (!echarts) {
log('ECharts is not Loaded');
return;
}
echarts.registerTheme('macarons', {
"color": [
"rgba(51, 87, 217, 1)",
"rgba(55, 197, 237, 1)",
"rgba(105, 210, 179, 1)",
"rgba(213, 237, 91, 1)",
"rgba(250, 142, 46, 1)",
"rgba(255, 71, 71, 1)",
"rgba(184, 88, 177, 1)",
"rgba(100, 141, 221, 1)",
"rgba(35, 172, 202, 1)",
"rgba(101, 167, 251, 1)",
"rgba(90, 187, 154, 1)",
"rgba(254, 219, 73, 1)",
"rgba(255, 110, 48, 1)",
"rgba(231, 22, 36, 1)",
"rgba(202, 22, 135, 1)",
"rgba(45, 162, 232, 1)",
"rgba(23, 206, 235, 1)",
"rgba(73, 202, 157, 1)",
"rgba(254, 184, 72, 1)",
"rgba(250, 130, 111, 1)",
"rgba(236, 100, 140, 1)",
"rgba(146, 135, 236, 1)",
"rgba(58, 177, 229, 1)",
"rgba(156, 219, 130, 1)",
"rgba(78, 229, 225, 1)",
"rgba(255, 159, 82, 1)",
"rgba(253, 99, 95, 1)",
"rgba(115, 121, 223, 1)",
"rgba(214, 98, 171, 1)",
"rgba(95, 104, 232, 1)",
],
});
}));
🌷下一步 在main.is中引用全局挂载
import macarons from "@/utils/macarons.js" Vue.use(macarons)
🌷最后一步 在初始化的时候加一个macarons即可
通过 echarts.registerTheme(name, theme)
方法注册到 echarts 中。在这里,name
是主题的名称,theme
是主题的配置信息对象。