Skip to content
Merged
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
9 changes: 6 additions & 3 deletions src/common/color.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-check

import { themes } from "../../themes/index.js";

/**
Expand Down Expand Up @@ -69,7 +71,6 @@ const fallbackColor = (color, fallbackColor) => {
* @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.
* @returns {CardColors} Card colors.
*/
const getCardColors = ({
Expand All @@ -80,11 +81,13 @@ const getCardColors = ({
border_color,
ring_color,
theme,
fallbackTheme = "default",
}) => {
const defaultTheme = themes[fallbackTheme];
const defaultTheme = themes["default"];
const isThemeProvided = theme !== null && theme !== undefined;

// @ts-ignore
const selectedTheme = isThemeProvided ? themes[theme] : defaultTheme;

const defaultBorderColor =
"border_color" in selectedTheme
? selectedTheme.border_color
Expand Down
Loading