Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add tegtBgColor and descColor as api parameter #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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 --------------------------------------------------------------------------------------------------------
Expand All @@ -71,12 +71,8 @@ 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"
? checkText(text, textBgColor, fontAlign, fontAlignY, stroke, strokeWidth)
: checkText(text, fontColor, fontAlign, fontAlignY, stroke, strokeWidth)
}`;
${textBg === "true" ? Model.textBg(textBgColor, fontAlign || 50, fontAlignY || 50, fontSize, text) : ""}
${checkText(text, fontColor, fontAlign, fontAlignY, stroke, strokeWidth)}`;
Comment on lines -74 to +75
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위 내용이 변경된 이유를 알 수 있을까요??

기존 결과물과 다르게 작동해요.

기존

https://capsule-render.vercel.app/api?type=rect&color=gradient&text=%20%20RECT%20%20&fontAlign=30&fontSize=30&textBg=true&desc=desc&descAlign=60&descAlignY=50

기존

변경 후

https://capsule-render-theta.vercel.app/api?type=rect&color=gradient&text=%20%20RECT%20%20&fontAlign=30&fontSize=30&textBg=true&desc=desc&descAlign=60&descAlignY=50

변경후


// set 'desc' - Always have the color of 'fontColor'.
let descScript = `${checkDesc(desc, descColor, descAlign, descAlignY)} `;
Expand Down