Files
discord-decomp/modules/guild_themes/GuildThemePresets.tsx
T
2026-11-01 12:12:55 +02:00

370 lines
7.4 KiB
TypeScript

// Metro module 4037 (f4038).
import { ThemeTypes } from "../../_bundle/Module505";
import Module689 from "../../_bundle/Module689";
import { COLOR_PALETTE } from "../client_themes/CustomThemesRandomUtils";
const r24 = {
TWILIGHT: 1,
PLUM: 2,
FIRE: 3,
GOLD_DUST: 4,
MOSS: 5,
JADE: 6,
OBSIDIAN: 7,
OCEAN: 8,
DENIM: 9,
BLURPLE: 10
};
const r26 = [r24.TWILIGHT, r24.DENIM, r24.OCEAN, r24.BLURPLE, r24.OBSIDIAN, r24.PLUM, r24.FIRE, r24.GOLD_DUST, r24.MOSS, r24.JADE];
const r36 = {};
r36[r24.TWILIGHT] = {
id: r24.TWILIGHT,
darkAppearance: {
color: "#69426A",
angle: 0,
baseMix: 100,
colors: [{
hex: "#69426A",
stop: 0
}, {
hex: "#111731",
stop: 100
}]
},
lightAppearance: {
color: "#FA9EFF",
angle: 0,
baseMix: 100,
colors: [{
hex: "#FA9EFF",
stop: 0
}, {
hex: "#5A7EFE",
stop: 100
}]
}
};
r36[r24.DENIM] = {
id: r24.DENIM,
darkAppearance: {
color: "#5359AD",
angle: 0,
baseMix: 100,
colors: [{
hex: "#5359AD",
stop: 0
}, {
hex: "#121238",
stop: 100
}]
},
lightAppearance: {
color: "#DBDBFF",
angle: 0,
baseMix: 100,
colors: [{
hex: "#DBDBFF",
stop: 0
}, {
hex: "#6060FF",
stop: 100
}]
}
};
r36[r24.OCEAN] = {
id: r24.OCEAN,
darkAppearance: {
color: "#245B92",
angle: 0,
baseMix: 100,
colors: [{
hex: "#245B92",
stop: 0
}, {
hex: "#141D40",
stop: 100
}]
},
lightAppearance: {
color: "#9ADBF7",
angle: 0,
baseMix: 100,
colors: [{
hex: "#9ADBF7",
stop: 0
}, {
hex: "#2D3CCA",
stop: 100
}]
}
};
r36[r24.BLURPLE] = {
id: r24.BLURPLE,
darkAppearance: {
color: "#533D9E",
angle: 0,
baseMix: 100,
colors: [{
hex: "#533D9E",
stop: 0
}, {
hex: "#1A1035",
stop: 100
}]
},
lightAppearance: {
color: "#C3BFFF",
angle: 0,
baseMix: 100,
colors: [{
hex: "#C3BFFF",
stop: 0
}, {
hex: "#816BDC",
stop: 100
}]
}
};
r36[r24.OBSIDIAN] = {
id: r24.OBSIDIAN,
darkAppearance: {
color: "#5E4C85",
angle: 0,
baseMix: 100,
colors: [{
hex: "#5E4C85",
stop: 0
}, {
hex: "#1E1740",
stop: 100
}]
},
lightAppearance: {
color: "#B59DF2",
angle: 0,
baseMix: 100,
colors: [{
hex: "#B59DF2",
stop: 0
}, {
hex: "#8F89D2",
stop: 100
}]
}
};
r36[r24.PLUM] = {
id: r24.PLUM,
darkAppearance: {
color: "#8A3F7F",
angle: 0,
baseMix: 100,
colors: [{
hex: "#8A3F7F",
stop: 0
}, {
hex: "#2C0D25",
stop: 100
}]
},
lightAppearance: {
color: "#E893FF",
angle: 0,
baseMix: 100,
colors: [{
hex: "#E893FF",
stop: 0
}, {
hex: "#FFADDC",
stop: 100
}]
}
};
r36[r24.FIRE] = {
id: r24.FIRE,
darkAppearance: {
color: "#9B2C2C",
angle: 0,
baseMix: 50,
colors: [{
hex: "#9B2C2C",
stop: 0
}, {
hex: "#2A0C0C",
stop: 100
}]
},
lightAppearance: {
color: "#FFEBCA",
angle: 0,
baseMix: 50,
colors: [{
hex: "#FFEBCA",
stop: 0
}, {
hex: "#FF8989",
stop: 100
}]
}
};
r36[r24.GOLD_DUST] = {
id: r24.GOLD_DUST,
darkAppearance: {
color: "#6C523D",
angle: 0,
baseMix: 50,
colors: [{
hex: "#6C523D",
stop: 0
}, {
hex: "#241912",
stop: 100
}]
},
lightAppearance: {
color: "#FFE7DA",
angle: 0,
baseMix: 50,
colors: [{
hex: "#FFE7DA",
stop: 0
}, {
hex: "#FFD89B",
stop: 100
}]
}
};
r36[r24.MOSS] = {
id: r24.MOSS,
darkAppearance: {
color: "#58694E",
angle: 0,
baseMix: 50,
colors: [{
hex: "#58694E",
stop: 0
}, {
hex: "#222A1C",
stop: 100
}]
},
lightAppearance: {
color: "#B7D19F",
angle: 0,
baseMix: 50,
colors: [{
hex: "#B7D19F",
stop: 0
}, {
hex: "#B1DCA4",
stop: 100
}]
}
};
r36[r24.JADE] = {
id: r24.JADE,
darkAppearance: {
color: "#297071",
angle: 0,
baseMix: 50,
colors: [{
hex: "#297071",
stop: 0
}, {
hex: "#18203F",
stop: 100
}]
},
lightAppearance: {
color: "#C5F0D2",
angle: 0,
baseMix: 50,
colors: [{
hex: "#C5F0D2",
stop: 0
}, {
hex: "#60ADB2",
stop: 100
}]
}
};
let c2314_4 = r36;
let c2314_5 = new Set(Object.values(r24));
let c2314_6 = r26.map((item) => c2314_4[item]);
export { r24 as GUILD_THEME_PRESET_IDS };
export const GUILD_THEME_DEFAULT_BASE_MIX = 74;
export const GUILD_THEME_DEFAULT_COLOR = "#5865F2";
export const GUILD_THEME_MIN_TONE = 15;
export const GUILD_THEME_MAX_TONE = 75;
export const GUILD_THEME_CUSTOM_SATURATION = 0.4;
export const GUILD_THEME_TONE_TRIM = 40;
export { c2314_6 as GUILD_THEME_PRESETS };
export function getGuildThemePreset(a0) {
return a0 != null ? c2314_5.has(a0) ? c2314_4[a0] : null : null;
}
export function getDefaultGuildThemePresetSettings() {
return {
presetId: c2314_6[0].id,
customUserThemeSettings: void 0
};
}
export function getGuildThemePresetAppearance(a0, a1) {
return a1 === ThemeTypes.LIGHT ? a0.lightAppearance : a0.darkAppearance;
}
export function getLinearGradientForGuildThemePreset(a0, a1) {
const r14 = a1 === ThemeTypes.LIGHT ? a0.lightAppearance : a0.darkAppearance;
return `linear-gradient(${r14.angle}deg, ${r14.colors.map((color) => `${color.hex} ${color.stop}%`).join(", ")})`;
}
export function getSingleColorGuildThemeGradientColors(a0, a1) {
const r7 = a1 === ThemeTypes.LIGHT ? {
minTone: 55,
maxTone: 75
} : {
minTone: 15,
maxTone: 35
};
const { minTone, maxTone } = r7;
const r11 = Module689(a0);
const r38 = r11.set("hsl.l", (minTone + (Math.max(15, Math.min(75, 100 * r11.get("hsl.l"))) - 15) / 60 * (maxTone - minTone)) / 100).hex();
const r41 = Module689(r38);
const r43 = a1 === ThemeTypes.LIGHT ? 0.2 : -0.2;
return [r38, r41.set("hsl.l", Math.max(0, Math.min(1, r41.get("hsl.l") + r43))).hex()];
}
export function getRandomSingleColorGuildTheme() {
const r1 = COLOR_PALETTE.length - 1;
const r29 = COLOR_PALETTE[Math.floor(Math.random() * (r1 - 0 + 1)) + 0];
const r41 = Math.min(45, Math.round(100 * Module689(r29).get("hsl.l")));
return {
color: Module689(Module689(r29).set("hsl.l", Math.max(0.15, Math.min(0.75, r41 / 100))).hex()).set("hsl.s", 0.4).hex(),
baseMix: Math.floor(Math.random() * 11) + 70
};
}
export function getSaturationPinnedColor(a0) {
return Module689(a0).set("hsl.s", 0.4).hex();
}
export function getToneAdjustedColor(a0, a1) {
return Module689(a0).set("hsl.l", Math.max(0.15, Math.min(0.75, a1 / 100))).hex();
}
export function getGuildThemeToneRange(a0) {
return a0 === ThemeTypes.LIGHT ? {
minTone: 55,
maxTone: 75
} : {
minTone: 15,
maxTone: 35
};
}
export function getThemeAdjustedToneColor(a0, a1) {
const r14 = a1 === ThemeTypes.LIGHT ? {
minTone: 55,
maxTone: 75
} : {
minTone: 15,
maxTone: 35
};
const { minTone, maxTone } = r14;
const r20 = Module689(a0);
return r20.set("hsl.l", (minTone + (Math.max(15, Math.min(75, 100 * r20.get("hsl.l"))) - 15) / 60 * (maxTone - minTone)) / 100).hex();
}
export function getHueAdjustedColor(a0, a1) {
return Module689(a0).set("hsl.h", a1).hex();
}