koishi-plugin-ll-bns-fortune 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +8 -6
- package/lib/render.js +6 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -104,12 +104,12 @@ const panelSchema = Schema.object({
|
|
|
104
104
|
measureRatio: Schema.number().min(0.5).max(1).step(0.01).default(0.98)
|
|
105
105
|
.description('文字块最大宽度占面板宽度的比例'),
|
|
106
106
|
}).collapse().description('面板位置(默认已按内置底图量好,换底图时才需要改)'),
|
|
107
|
-
footerCharsPerLine: Schema.number().role('slider').min(6).max(30).step(1).default(
|
|
107
|
+
footerCharsPerLine: Schema.number().role('slider').min(6).max(30).step(1).default(17)
|
|
108
108
|
.description('底部区块的字号(每行几个字,调小字更大)'),
|
|
109
109
|
footer: Schema.object({
|
|
110
|
-
x: Schema.number().role('ratio').default(0.
|
|
111
|
-
y: Schema.number().role('ratio').default(0.
|
|
112
|
-
w: Schema.number().role('ratio').default(0.
|
|
110
|
+
x: Schema.number().role('ratio').default(0.655).description('底部区块左边缘:占整图宽度'),
|
|
111
|
+
y: Schema.number().role('ratio').default(0.700).description('底部区块上边缘:占整图高度'),
|
|
112
|
+
w: Schema.number().role('ratio').default(0.265).description('底部区块宽度:占整图宽度'),
|
|
113
113
|
h: Schema.number().role('ratio').default(0.150).description('底部区块高度:占整图高度'),
|
|
114
114
|
}).collapse().description('底部区块位置(放「今日玄学地图」,默认对准底图下部那个小框)'),
|
|
115
115
|
}).description('排版与对齐')
|
|
@@ -238,6 +238,8 @@ exports.Config = Schema.intersect([
|
|
|
238
238
|
panel: panelSchema,
|
|
239
239
|
colors: colorsSchema,
|
|
240
240
|
starColors: starColorsSchema,
|
|
241
|
+
dailyColor: Schema.string().role('color').default('#4A3A55')
|
|
242
|
+
.description('「每日一言」的文字颜色(放底图下部小框里那句)'),
|
|
241
243
|
cards: cardSchema,
|
|
242
244
|
|
|
243
245
|
renderAdvanced: Schema.object({
|
|
@@ -673,7 +675,7 @@ exports.apply = function apply (ctx, config) {
|
|
|
673
675
|
const result = await renderer.renderFortune(ctx, {
|
|
674
676
|
template: config.template || data.DEFAULT_FORMAT,
|
|
675
677
|
values,
|
|
676
|
-
colors: config.colors || {},
|
|
678
|
+
colors: Object.assign({}, config.colors || {}, { daily: config.dailyColor }),
|
|
677
679
|
fontPath: plan.files.length ? plan.files[0] : ((config.fontPath || '').trim() || null),
|
|
678
680
|
fontFiles: plan.files,
|
|
679
681
|
fontFamilies: families,
|
|
@@ -722,7 +724,7 @@ exports.apply = function apply (ctx, config) {
|
|
|
722
724
|
fit: render.fit,
|
|
723
725
|
supersample: Number(render.supersample) || 1,
|
|
724
726
|
footer: config.panel.footer,
|
|
725
|
-
footerCharsPerLine: Number(config.panel.footerCharsPerLine) ||
|
|
727
|
+
footerCharsPerLine: Number(config.panel.footerCharsPerLine) || 17,
|
|
726
728
|
},
|
|
727
729
|
backgroundBuffer,
|
|
728
730
|
})
|
package/lib/render.js
CHANGED
|
@@ -339,12 +339,14 @@ function buildLines (template, values, colors, ratio, options) {
|
|
|
339
339
|
if (value === undefined) {
|
|
340
340
|
segments.push({ text: matched[0], color: colors.text })
|
|
341
341
|
} else {
|
|
342
|
-
// {mapText}
|
|
343
|
-
|
|
342
|
+
// {mapText} / {daily} 这类补充说明用正文色(不高亮),其他取值用高亮色。
|
|
343
|
+
// 底部小框里的每日一言如果也用高亮色,一整行饱和玫红会非常吵。
|
|
344
|
+
const isPlain = key === 'mapText' || key === 'daily' || key === 'stars'
|
|
345
|
+
const color = key === 'daily' && colors.daily ? colors.daily : (isPlain ? colors.text : colors.accent)
|
|
344
346
|
segments.push({
|
|
345
347
|
text: String(value),
|
|
346
|
-
color
|
|
347
|
-
bold:
|
|
348
|
+
color,
|
|
349
|
+
bold: !isPlain,
|
|
348
350
|
key,
|
|
349
351
|
})
|
|
350
352
|
}
|