decord/source/modules/guild_profile/native/GuildProfileUtils.tsx

84 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 9552
// Function ID: 9553
2026-07-20 16:05:17 +00:00
// Name: useProfilePrimaryColor
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 4669, 1435, 8384, 5316, 2]
2026-07-20 16:05:17 +00:00
// Exports: getProfilePrimaryColor, useProfilePrimaryColor
2026-08-24 06:08:38 +00:00
// Module 9552 (useProfilePrimaryColor)
import getAvatarURLDefault from "getAvatarURL" /* 1435 */;
import hasFetchedColors from "hasFetchedColors" /* 8384 */;
import hasFetchedColorsDefault from "hasFetchedColors" /* 8384 */;
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "maybeApplyNoTextColorForLightCustomTheme" /* 4669 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
const result = require("set").fileFinishedImporting("modules/guild_profile/native/GuildProfileUtils.tsx");
2026-07-20 16:05:17 +00:00
export const useProfilePrimaryColor = function useProfilePrimaryColor(guildProfile, token) {
let guildIconURL = null;
if (null != guildProfile) {
guildIconURL = null;
if (null == guildProfile.brandColorPrimary) {
2026-08-24 06:08:38 +00:00
let obj = getAvatarURLDefault;
2026-07-29 08:29:29 +00:00
obj = { id: null, icon: null, size: 64 };
({ id: obj2[0], icon: obj2[1] } = guildProfile);
2026-07-20 16:05:17 +00:00
guildIconURL = obj.getGuildIconURL(obj);
}
}
2026-08-24 06:08:38 +00:00
let brandColorPrimary = hasFetchedColorsDefault(guildIconURL, token);
2026-07-29 08:29:29 +00:00
brandColorPrimary = undefined;
if (guildProfile != null) {
2026-07-20 16:05:17 +00:00
brandColorPrimary = guildProfile.brandColorPrimary;
}
if (null != brandColorPrimary) {
brandColorPrimary = guildProfile.brandColorPrimary;
}
return brandColorPrimary;
};
export const getProfilePrimaryColor = function getProfilePrimaryColor(guildProfileFromInvite) {
if (null == guildProfileFromInvite) {
return null;
} else if (null != guildProfileFromInvite.brandColorPrimary) {
return guildProfileFromInvite.brandColorPrimary;
} else {
2026-07-29 08:29:29 +00:00
let obj = { id: null, icon: null, size: 64 };
({ id: obj6[0], icon: obj6[1] } = guildProfileFromInvite);
2026-08-24 06:08:38 +00:00
const guildIconURL = getAvatarURLDefault.getGuildIconURL(obj);
2026-07-20 16:05:17 +00:00
if (null == guildIconURL) {
return null;
} else {
2026-08-24 06:08:38 +00:00
hasFetchedColors.maybeFetchColors(guildIconURL);
const useColorStore = hasFetchedColors.useColorStore;
2026-07-29 08:29:29 +00:00
const tmp13 = useColorStore.getState().palette[guildIconURL];
2026-07-20 16:05:17 +00:00
let first;
2026-07-29 08:29:29 +00:00
if (tmp13 != null) {
first = tmp13[0];
2026-07-20 16:05:17 +00:00
}
if (null != first) {
[tmp4, tmp5, tmp6] = callback(first, 3);
2026-07-29 08:29:29 +00:00
obj = { r: null, g: null, b: null };
obj[0] = tmp4;
obj[1] = tmp5;
obj[2] = tmp6;
2026-07-20 16:05:17 +00:00
const tmp3 = callback(first, 3);
2026-08-24 06:08:38 +00:00
const obj2 = tmp8(5316)(obj);
2026-07-29 08:29:29 +00:00
let num2 = 1;
2026-08-24 06:08:38 +00:00
({ h, s, l } = tmp8(5316)(obj).toHsl());
if (closure_4.desaturateUserColors) {
num2 = closure_4.saturation;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { h: null, s: null, l: null };
obj[0] = h;
obj[1] = s * num2;
obj[2] = l;
2026-08-24 06:08:38 +00:00
const toHslResult = tmp8(5316)(obj).toHsl();
return tmp8(5316)(obj).toHexString();
2026-07-20 16:05:17 +00:00
} else {
return null;
}
2026-08-24 06:08:38 +00:00
const obj7 = hasFetchedColors;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const obj5 = getAvatarURLDefault;
2026-07-20 16:05:17 +00:00
}
};