From eb1a97ee0536a093d17920d0f90e8882d793e523 Mon Sep 17 00:00:00 2001 From: Alice Date: Sat, 11 May 2024 15:16:10 +0900 Subject: [PATCH 1/2] Add tegtBgColor as api parameter --- api/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/api/index.js b/api/index.js index 0fad02a..38ab5a5 100644 --- a/api/index.js +++ b/api/index.js @@ -35,8 +35,8 @@ export default (req, res) => { } = req.query; let color = req.query.color || "B897FF"; let fontColor = req.query.fontColor; - let descColor = req.query.fontColor; - let textBgColor = "#ffffff"; + let descColor = req.query.descColor; + let textBgColor = req.query.textBgColor || "#ffffff"; let stroke = req.query.stroke || (req.query.strokeWidth ? "B897FF" : "none"); let strokeWidth = req.query.strokeWidth || (req.query.stroke === "none" ? "0" : "1"); @@ -71,11 +71,9 @@ export default (req, res) => { // set 'text' - The layout changes depending on whether or not 'textBg' is used. let textScript = ` - ${textBg === "true" ? Model.textBg(fontColor, fontAlign || 50, fontAlignY || 50, fontSize, text) : ""} + ${textBg === "true" ? Model.textBg(textBgColor, fontAlign || 50, fontAlignY || 50, fontSize, text) : ""} ${ - textBg === "true" - ? checkText(text, textBgColor, fontAlign, fontAlignY, stroke, strokeWidth) - : checkText(text, fontColor, fontAlign, fontAlignY, stroke, strokeWidth) + checkText(text, fontColor, fontAlign, fontAlignY, stroke, strokeWidth) }`; // set 'desc' - Always have the color of 'fontColor'. From 60a74fc699ed70bd498206a36524e491d472a74f Mon Sep 17 00:00:00 2001 From: Alice Date: Sat, 11 May 2024 16:03:30 +0900 Subject: [PATCH 2/2] Add DescColor as api parameter --- api/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/api/index.js b/api/index.js index 38ab5a5..0962e67 100644 --- a/api/index.js +++ b/api/index.js @@ -52,7 +52,7 @@ export default (req, res) => { else if (color === "timeAuto" || color === "timeGradient") [color, fontColor, textBgColor] = generateAutoByTime(color, fontColor); else color = checkCustomColor(color); - descColor = fontColor; + descColor = descColor ? descColor : fontColor; } //- Layout -------------------------------------------------------------------------------------------------------- @@ -72,9 +72,7 @@ export default (req, res) => { // set 'text' - The layout changes depending on whether or not 'textBg' is used. let textScript = ` ${textBg === "true" ? Model.textBg(textBgColor, fontAlign || 50, fontAlignY || 50, fontSize, text) : ""} - ${ - checkText(text, fontColor, fontAlign, fontAlignY, stroke, strokeWidth) - }`; + ${checkText(text, fontColor, fontAlign, fontAlignY, stroke, strokeWidth)}`; // set 'desc' - Always have the color of 'fontColor'. let descScript = `${checkDesc(desc, descColor, descAlign, descAlignY)} `;