Add borderRadius param

This commit is contained in:
iGalaxyYT
2021-06-21 02:56:21 -07:00
parent 957ea9a660
commit 42b08bcbd5
2 changed files with 9 additions and 2 deletions

View File

@@ -33,6 +33,10 @@ Append the query param `theme=:theme` to the end of the URL, replacing `:theme`
Append the query param `bg=:color` to the end of the URL, replacing `:color` with a hex color of your choice (omit the #) Append the query param `bg=:color` to the end of the URL, replacing `:color` with a hex color of your choice (omit the #)
### ___Border Radius___
Append the query param `borderRadius=:radius` to the end of the URL, replacing `:radius` with a radius of your choice. (default `10px`)
### ___Toggle Animated Avatar___ ### ___Toggle Animated Avatar___
If you have an animated avatar, append the query param `animated=:bool` to the end of the URL, replacing `:bool` with `true` or `false`. This is set to `true` by default. If you have an animated avatar, append the query param `animated=:bool` to the end of the URL, replacing `:bool` with `true` or `false`. This is set to `true` by default.

View File

@@ -11,6 +11,7 @@ type Parameters = {
animated?: string; animated?: string;
hideDiscrim?: string; hideDiscrim?: string;
hideStatus?: string; hideStatus?: string;
borderRadius?: string;
} }
const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<string> => { const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<string> => {
@@ -24,7 +25,8 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
backgroundColor: string = '1a1c1f', backgroundColor: string = '1a1c1f',
theme = 'dark', theme = 'dark',
discrim = 'show', discrim = 'show',
hideStatus = 'false'; hideStatus = 'false',
borderRadius = '10px';
if (body.data.activities[0]?.emoji?.animated) statusExtension = "gif"; if (body.data.activities[0]?.emoji?.animated) statusExtension = "gif";
if (body.data.discord_user.avatar && body.data.discord_user.avatar.startsWith("a_")) avatarExtension = "gif"; if (body.data.discord_user.avatar && body.data.discord_user.avatar.startsWith("a_")) avatarExtension = "gif";
@@ -37,6 +39,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
theme = 'light'; theme = 'light';
} }
if (params.bg) backgroundColor = params.bg; if (params.bg) backgroundColor = params.bg;
if (params.borderRadius) borderRadius = params.borderRadius;
switch (body.data.discord_status) { switch (body.data.discord_status) {
case "online": case "online":
@@ -74,7 +77,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 5px; padding: 5px;
border-radius: 10px; border-radius: ${borderRadius};
"> ">
<div style=" <div style="
width: 400px; width: 400px;