Skip to content

Commit 4f1fbbc

Browse files
committed
backend(themes): add a new 'border' query param
1 parent 9d728e7 commit 4f1fbbc

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/cards/card-builder.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default class CardBuilder {
100100
return this;
101101
}
102102

103-
public bg(bgColor = ""): CardBuilder {
103+
public bgColor(bgColor = ""): CardBuilder {
104104
if (isHexColor(bgColor)) {
105105
this.card.setTheme({
106106
...this.card.getTheme(),
@@ -111,6 +111,17 @@ export default class CardBuilder {
111111
return this;
112112
}
113113

114+
public borderColor(border = ""): CardBuilder {
115+
if (isHexColor(border)) {
116+
this.card.setTheme({
117+
...this.card.getTheme(),
118+
borderColor: border,
119+
});
120+
}
121+
122+
return this;
123+
}
124+
114125
public lines(
115126
cb: (line: number, addBadge: (b: Badge) => void) => void
116127
): CardBuilder {

src/controllers/cards-controller.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const getCard = async (req: Request, res: Response) => {
1818
lineHeight,
1919
width,
2020
bg,
21+
border,
2122
} = req.query;
2223

2324
const card = new CardBuilder()
@@ -40,7 +41,8 @@ export const getCard = async (req: Request, res: Response) => {
4041
addBadge(b)
4142
);
4243
})
43-
.bg(bg?.toString())
44+
.bgColor(bg?.toString())
45+
.borderColor(border?.toString())
4446
.build();
4547

4648
res.setHeader("Content-Type", "image/svg+xml");

0 commit comments

Comments
 (0)