diff --git a/render/common.js b/render/common.js index d61afa9..05cdb6c 100644 --- a/render/common.js +++ b/render/common.js @@ -1,7 +1,8 @@ const getTheme = require('../common/theme.js'); function render(items, theme = 'light') { - const {titleColor, backgroundColor, labelColor, valueColor} = getTheme(theme); + const { titleColor, backgroundColor, labelColor, valueColor } = + getTheme(theme); let textTags = ''; for (let i = 0; i < items.length; i++) { items[i].id = `key_${i}`; @@ -21,18 +22,18 @@ function render(items, theme = 'light') { textTags += renderText(items[i]); } - return ` + return ` - - - - - - + + + + + + - - + + ${textTags} @@ -43,12 +44,20 @@ function renderText(data) { let weight = ''; if (data.type === 'title') { weight = ` font-weight="700" `; - return `${data.text}`; + return `${data.text}`; } - return `${data.text}\n`; + return `${data.text}\n`; } -function constructItem(translate_x, translate_y, text, type, font_size, color = '', font = 'SegoeUI, Segoe UI') { +function constructItem( + translate_x, + translate_y, + text, + type, + font_size, + color = '', + font = 'SegoeUI, Segoe UI, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei' +) { return { translate_x: translate_x, translate_y: translate_y, @@ -56,10 +65,9 @@ function constructItem(translate_x, translate_y, text, type, font_size, color = type: type, font_size: font_size, color: color, - font: font + font: font, }; - } exports.render = render; -exports.constructItem = constructItem; \ No newline at end of file +exports.constructItem = constructItem;