Files
discord-decomp/sources/modules/client_themes/ClientThemesUtils.tsx
T
2026-07-28 01:06:53 +03:00

78 lines
4.2 KiB
TypeScript

/* Metro module 3999; source: modules/client_themes/ClientThemesUtils.tsx; dependencies: [3965, 1313, 482, 696, 2] */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
import * as ClientThemesConstantsModule from './ClientThemesConstants.tsx'; /* Metro dependency 3965 */
function _fun32865(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#32865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4157:6, offset: 0x010201aa, size: 223 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ClientThemesConstantsModule;
const env0_2 = value.LEGACY_STANDARD_BACKGROUND_THEMES;
const env0_3 = value.REFRESH_STANDARD_BACKGROUND_THEMES;
value = require(1313) /* metro dependency 1313: ThemeConstants */;
const env0_4 = value.PROTO_THEME_MAP_MOBILE;
value.PROTO_THEME_MAP_WEB_REFRESH;
(FileImportTrackerModule).fileFinishedImporting('modules/client_themes/ClientThemesUtils.tsx');
exports.getThemeForColor = function(a0) {
return a0.l <= 0.3 ? ThemeTypes.DARK : ThemeTypes.LIGHT;
};
exports.getLinearGradientForBackgroundGradient = function({angle, colors}) {
var value = colors.map(_fun32868);
value = value.join(', ');
return 'linear-gradient(' + angle + 'deg, ' + value + ')';
};
exports.areThemesEqualForGradientThemes = areThemesEqualForGradientThemes;
exports.getBaseTheme = function(a0) {
return PROTO_THEME_MAP_MOBILE[a0];
};
exports.getThemeName = getThemeName;
function getLinearGradientForBackgroundGradient({angle, colors}) { // fn#32867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4157:471, offset: 0x010202bb, size: 87 bytes, params: 2, frame: 17
let value = colors.map(_fun32868);
value = value.join(', ');
return 'linear-gradient(' + angle + 'deg, ' + value + ')';
function _fun32868({token, stop}) { // fn#32868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4157:580, offset: 0x01020312, size: 95 bytes, params: 2, frame: 17
let value = environment.__proto__;
value = require(696) /* metro dependency 696: shimsNative */;
value = value.unsafe_getResolvedRawColor(token, {saturation: 1});
return '' + value + ' ' + stop + '%';
}
}
function areThemesEqualForGradientThemes(a0, a1) { // fn#32869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4157:715, offset: 0x01020371, size: 87 bytes, params: 3, frame: 6
var r1;
var r0;
const value = a0 === a1;
if (value) {
r0 = value;
} else {
r1 = a0 === ThemeTypes.DARK && a1 === ThemeTypes.DARKER;
r1 = !r1 ? a0 === ThemeTypes.DARKER && a1 === ThemeTypes.DARK : r1;
r0 = r1;
}
return r0;
}
function getThemeName(a0, a1) { // fn#32871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4157:867, offset: 0x010203c8, size: 81 bytes, params: 3, frame: 12
var r1;
const env0_0 = a0;
let value = (a1 ? REFRESH_STANDARD_BACKGROUND_THEMES : LEGACY_STANDARD_BACKGROUND_THEMES).find(_fun32872);
if (value == null) {
r1 = undefined;
} else {
value = value.getName();
r1 = value;
}
return r1 ?? '';
function _fun32872({theme}) { // fn#32872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4157:941, offset: 0x01020419, size: 22 bytes, params: 2, frame: 2
return theme === env0_0;
}
}
}
global.__d(_fun32865, 3999, [3965, 1313, 482, 696,
2]) /* metro module 3999, dependencies: [3965, 1313, 482, 696, 2] */;