export const config = {
vlpn_c: {
"blue": {
Background: "#0574fa",
BorderColor: "#fff",
TextColor: "#fff",
},
"yellow": {
Background: "#ffcc00",
BorderColor: "#000",
TextColor: "#000",
},
"black": {
Background: "#000",
BorderColor: "#fff",
TextColor: "#fff",
},
"white": {
Background: "#fff",
BorderColor: "#000",
TextColor: "#000"
},
"green": {
Background: "#38df92",
BorderColor: "#000",
TextColor: "#000",
},
}
};
export function setVLPNColor(VLPNColor) {
const REG = /[a-zA-Z]/;
const COLOR_MAP = [{
Code: "green",
Value: "绿色"
}, {
Code: "white",
Value: "白色"
}, {
Code: "yellow",
Value: "黄色"
}, {
Code: "red",
Value: "红色"
}, {
Code: "black",
Value: "黑色"
}, {
Code: "blue",
Value: "蓝色"
}];
// 如果是中文名称,转英文名称
if (!REG.test(VLPNColor)) {
let index = COLOR_MAP.findIndex(color => color.Value == VLPNColor);
VLPNColor = index > -1 ? COLOR_MAP[index].Code : VLPNColor;
}
// if (!config.vlpn_c[VLPNColor]) return `padding: 2px 4px;`;
if (!config.vlpn_c[VLPNColor]) VLPNColor = "blue"; // 给个默认蓝色
const vlpn_c = config.vlpn_c[VLPNColor];
return `display: inline-block; border-radius: 6px; border-style: double;
text-align: center; font-size: 11pt; padding:2px 4px; font-weight: 700;
background: ${vlpn_c.Background}; color:${vlpn_c.TextColor}; border-color:${vlpn_c.BorderColor};`;
}