diff --git a/src/components/ProviderIcon.tsx b/src/components/ProviderIcon.tsx index 0348d7f94..2628e4dd2 100644 --- a/src/components/ProviderIcon.tsx +++ b/src/components/ProviderIcon.tsx @@ -39,9 +39,13 @@ export const ProviderIcon: React.FC = ({ }; }, [size]); - // 获取有效颜色:优先使用传入的 color,否则从元数据获取 defaultColor + // 获取有效颜色:优先使用传入的有效 color,否则从元数据获取 defaultColor const effectiveColor = useMemo(() => { - if (color) return color; + // 只有当 color 是有效的非空字符串时才使用 + if (color && typeof color === 'string' && color.trim() !== '') { + return color; + } + // 否则从元数据获取 defaultColor if (icon) { const metadata = getIconMetadata(icon); // 只有当 defaultColor 不是 currentColor 时才使用