fix: resolve vscode errors inside colors related code (#4556)

Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
Ophelia Goldstein
2025-10-25 18:27:53 +02:00
committed by martin-mfg
co-authored by Alexandr
parent 1ac197ceae
commit 26c3cf421f
+10 -5
View File
@@ -241,8 +241,8 @@ const request = (data, headers) => {
* @param {string=} args.bg_color Card background color.
* @param {string=} args.border_color Card border color.
* @param {string=} args.ring_color Card ring color.
* @param {string=} args.theme Card theme.
* @param {string=} args.fallbackTheme Fallback theme.
* @param {keyof themes=} args.theme Card theme.
* @param {keyof themes=} args.fallbackTheme Fallback theme.
* @returns {CardColors} Card colors.
*/
const getCardColors = ({
@@ -256,9 +256,13 @@ const getCardColors = ({
fallbackTheme = "default",
}) => {
const defaultTheme = themes[fallbackTheme];
const selectedTheme = themes[theme] || defaultTheme;
const isThemeProvided = theme !== null && theme !== undefined;
const selectedTheme = isThemeProvided ? themes[theme] : defaultTheme;
const defaultBorderColor =
selectedTheme.border_color || defaultTheme.border_color;
"border_color" in selectedTheme
? selectedTheme.border_color
: // @ts-ignore
defaultTheme.border_color;
// get the color provided by the user else the theme color
// finally if both colors are invalid fallback to default theme
@@ -270,6 +274,7 @@ const getCardColors = ({
// get the color provided by the user else the theme color
// finally if both colors are invalid we use the titleColor
const ringColor = fallbackColor(
// @ts-ignore
ring_color || selectedTheme.ring_color,
titleColor,
);
@@ -341,7 +346,7 @@ const UPSTREAM_API_ERRORS = [
* @param {string=} args.renderOptions.text_color Card text color.
* @param {string=} args.renderOptions.bg_color Card background color.
* @param {string=} args.renderOptions.border_color Card border color.
* @param {string=} args.renderOptions.theme Card theme.
* @param {keyof themes=} args.renderOptions.theme Card theme.
* @param {boolean=} args.renderOptions.show_repo_link Whether to show repo link or not.
* @returns {string} The SVG markup.
*/