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

87 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 9147
// Function ID: 9148
2026-07-20 16:05:17 +00:00
// Name: useProfilePrimaryColor
2026-08-05 07:35:12 +00:00
// Dependencies: [32, 4247, 1416, 8017, 6905, 2]
2026-07-20 16:05:17 +00:00
// Exports: getProfilePrimaryColor, useProfilePrimaryColor
2026-08-05 07:35:12 +00:00
// Module 9147 (useProfilePrimaryColor)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import maybeApplyNoTextColorForLightCustomTheme from "maybeApplyNoTextColorForLightCustomTheme";
2026-07-23 10:11:24 +00:00
const require = arg1;
const result = require("getAvatarURL").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-07-29 08:29:29 +00:00
let obj = importDefault(1416);
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-05 07:35:12 +00:00
let brandColorPrimary = importDefault(8017)(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) {
let h;
let l;
let s;
let tmp4;
let tmp5;
let tmp6;
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);
const guildIconURL = importDefault(1416).getGuildIconURL(obj);
2026-07-20 16:05:17 +00:00
if (null == guildIconURL) {
return null;
} else {
2026-08-05 07:35:12 +00:00
require(8017) /* hasFetchedColors */.maybeFetchColors(guildIconURL);
const useColorStore = require(8017) /* 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-05 07:35:12 +00:00
const obj2 = tmp8(6905)(obj);
2026-07-29 08:29:29 +00:00
let num2 = 1;
2026-08-05 07:35:12 +00:00
({ h, s, l } = tmp8(6905)(obj).toHsl());
2026-07-29 08:29:29 +00:00
if (maybeApplyNoTextColorForLightCustomTheme.desaturateUserColors) {
num2 = maybeApplyNoTextColorForLightCustomTheme.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-05 07:35:12 +00:00
const toHslResult = tmp8(6905)(obj).toHsl();
return tmp8(6905)(obj).toHexString();
2026-07-20 16:05:17 +00:00
} else {
return null;
}
2026-08-05 07:35:12 +00:00
const obj7 = require(8017) /* hasFetchedColors */;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj5 = importDefault(1416);
2026-07-20 16:05:17 +00:00
}
};