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

183 lines
5.8 KiB
TypeScript

// Metro module 9793 (f9794).
import _slicedToArray from "../../_bundle/_slicedToArray";
import AccessibilityStore from "../a11y/AccessibilityStore";
import { getValueInColorGradientByPercentage } from "../user_profile/UserProfileGradientUtils";
import tinycolor from "../../_bundle/tinycolor";
import { useStateFromStores } from "../../_bundle/defaultAreStatesEqual";
export default function createUseCollectiblesShopStyles(c17497_0) {
return (a0) => {
let r36, r112, r224;
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.saturation);
if (a0 == null) {
return {};
}
const backgroundColors = a0.backgroundColors;
const length = backgroundColors.length;
let backgroundColors2 = void 0;
if (length !== 0) {
if (backgroundColors.length === 1) {
r36 = {
primary: backgroundColors[0],
secondary: backgroundColors[0],
border: backgroundColors[0].setAlpha(0.4),
label: backgroundColors[0].isLight() ? c17497_0.dark : c17497_0.light
};
} else {
const tertiary = backgroundColors.length > 2 ? backgroundColors[2] : void 0;
const r15 = backgroundColors[0];
const r18 = backgroundColors[1];
const r42 = r15.toRgb();
const r21 = r18.toRgb();
const r56 = _slicedToArray(getValueInColorGradientByPercentage([r42.r, r42.g, r42.b], [r21.r, r21.g, r21.b], 50), 3);
r36 = {
primary: backgroundColors[0],
secondary: backgroundColors[1],
tertiary,
border: tinycolor({
r: r56[0],
g: r56[1],
b: r56[2]
}).setAlpha(0.4),
label: null
};
const r66 = backgroundColors[0];
const r67 = backgroundColors[1];
const r69 = r66.toRgb();
const r71 = r67.toRgb();
const r83 = _slicedToArray(getValueInColorGradientByPercentage([r69.r, r69.g, r69.b], [r71.r, r71.g, r71.b], 50), 3);
r36.label = tinycolor({
r: r83[0],
g: r83[1],
b: r83[2]
}).isLight() ? c17497_0.dark : c17497_0.light;
}
backgroundColors2 = r36;
}
const buttonColors = a0.buttonColors;
const length2 = buttonColors.length;
let buttonColors2 = void 0;
if (length2 !== 0) {
if (buttonColors.length === 1) {
r112 = {
primary: buttonColors[0],
secondary: buttonColors[0],
text: buttonColors[0].isLight() ? c17497_0.dark : c17497_0.light
};
} else {
const r114 = buttonColors[0];
const r115 = buttonColors[1];
const r117 = r114.toRgb();
const r119 = r115.toRgb();
const r135 = _slicedToArray(getValueInColorGradientByPercentage([r117.r, r117.g, r117.b], [r119.r, r119.g, r119.b], 50), 3);
r112 = {
primary: buttonColors[0],
secondary: buttonColors[1],
text: tinycolor({
r: r135[0],
g: r135[1],
b: r135[2]
}).isLight() ? c17497_0.dark : c17497_0.light
};
}
buttonColors2 = r112;
}
const r105 = {
backgroundColors: backgroundColors2,
buttonColors: buttonColors2,
confettiColors: a0.confettiColors
};
if (stateFromStores === 1) {
r224 = {
...r105
};
} else {
const r157 = r105.backgroundColors != null;
let backgroundColors3 = void 0;
if (r157) {
const r162 = r105.backgroundColors.primary.toHsl();
const r172 = {
primary: tinycolor({
h: r162.h,
s: r162.s * stateFromStores,
l: r162.l
}),
secondary: null,
tertiary: null,
border: null,
label: null
};
const r176 = r105.backgroundColors.secondary.toHsl();
r172.secondary = tinycolor({
h: r176.h,
s: r176.s * stateFromStores,
l: r176.l
});
const r187 = r105.backgroundColors.tertiary != null;
let tertiary2 = void 0;
if (r187) {
const r192 = r105.backgroundColors.tertiary.toHsl();
tertiary2 = tinycolor({
h: r192.h,
s: r192.s * stateFromStores,
l: r192.l
});
}
r172.tertiary = tertiary2;
const r203 = r105.backgroundColors.border.toHsl();
r172.border = tinycolor({
h: r203.h,
s: r203.s * stateFromStores,
l: r203.l
});
const r215 = r105.backgroundColors.label.toHsl();
r172.label = tinycolor({
h: r215.h,
s: r215.s * stateFromStores,
l: r215.l
});
backgroundColors3 = r172;
}
const r226 = r105.buttonColors != null;
let buttonColors3 = void 0;
if (r226) {
const r231 = r105.buttonColors.primary.toHsl();
const r241 = {
primary: tinycolor({
h: r231.h,
s: r231.s * stateFromStores,
l: r231.l
}),
secondary: null,
text: null
};
const r245 = r105.buttonColors.secondary.toHsl();
r241.secondary = tinycolor({
h: r245.h,
s: r245.s * stateFromStores,
l: r245.l
});
const r257 = r105.buttonColors.text.toHsl();
r241.text = tinycolor({
h: r257.h,
s: r257.s * stateFromStores,
l: r257.l
});
buttonColors3 = r241;
}
r224 = {
backgroundColors: backgroundColors3,
buttonColors: buttonColors3,
confettiColors: r105.confettiColors.map((confettiColor) => {
const r8 = confettiColor.toHsl();
return tinycolor({
h: r8.h,
s: r8.s * stateFromStores,
l: r8.l
});
})
};
}
return r224;
};
};