Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/fix_unset_usercards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

Fix unset User Profile cards having incorectly colored text.
9 changes: 7 additions & 2 deletions src/app/hooks/useUserProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,13 @@ export const useUserProfile = (
const resolvedPronouns = localPronouns || spacePronouns || data?.pronouns;

const rawHeroBrightness = data?.heroColorScheme?.brightness;
const heroCardsAllowed = shouldApplyUserHeroCards(renderUserCardsMode, rawHeroBrightness);
const validHeroColor = heroCardsAllowed ? isValidHex(data?.heroColorScheme?.color) : undefined;
const rawHeroColor = data?.heroColorScheme?.color;
const heroCardsAllowed = shouldApplyUserHeroCards(
renderUserCardsMode,
rawHeroBrightness,
rawHeroColor
);
const validHeroColor = heroCardsAllowed ? isValidHex(rawHeroColor) : undefined;
const heroBrightness = heroCardsAllowed ? rawHeroBrightness : undefined;
const testUserHeroColor = shadeColor(validHeroColor, heroBrightness === 'dark' ? -80 : 80);

Expand Down
5 changes: 3 additions & 2 deletions src/app/state/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ export function isPixelatedViewerRendering(mode: PixelatedImageRenderingMode): b

export function shouldApplyUserHeroCards(
mode: RenderUserCardsMode,
brightness: string | undefined
brightness?: string,
color?: string
): boolean {
if (!color || (brightness !== 'light' && brightness !== 'dark')) return false;
if (mode === 'none') return false;
if (mode === 'both') return true;
if (brightness !== 'light' && brightness !== 'dark') return false;
return brightness === mode;
}

Expand Down
Loading