decord/alpha/source/modules/client_themes/ClientThemesUtils.tsx

86 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-10-03 08:58:59 +00:00
// Module ID: 1239
// Function ID: 1240
// Name: ClientThemesUtils
2026-10-03 08:58:59 +00:00
// Dependencies: [1240, 1196, 1096, 4729, 586, 2]
2026-08-11 06:20:06 +00:00
// Exports: areThemesEqualForGradientThemes, getBaseTheme, getCustomThemeBaseTheme, getLinearGradientForBackgroundGradient, getThemeForColor, getThemeName, hasCustomTheme, resolveThemeWithCustomSettings
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
// Module 1239 (ClientThemesUtils)
import shims from "shims" /* 586 */;
import Constants from "Constants" /* 1096 */;
import ThemeConstants from "ThemeConstants" /* 1196 */;
import ClientThemesConstants from "ClientThemesConstants" /* 1240 */;
import shared from "shared" /* 4729 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
let closure_2 = ClientThemesConstants.REFRESH_STANDARD_BACKGROUND_THEMES;
let closure_3 = ThemeConstants.PROTO_THEME_MAP_WEB_REFRESH;
const ThemeTypes = Constants.ThemeTypes;
const result = size.fileFinishedImporting("modules/client_themes/ClientThemesUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getThemeForColor = function getThemeForColor(l) {
2026-10-03 08:58:59 +00:00
let LIGHT;
2026-07-20 16:05:17 +00:00
if (l.l <= 0.3) {
2026-10-03 08:58:59 +00:00
LIGHT = ThemeTypes.DARK;
2026-07-20 16:05:17 +00:00
} else {
LIGHT = ThemeTypes.LIGHT;
}
return LIGHT;
};
2026-08-11 06:20:06 +00:00
export const getCustomThemeBaseTheme = function getCustomThemeBaseTheme(theme) {
2026-10-03 08:58:59 +00:00
const obj = shared;
return obj.isThemeDark(theme) ? ThemeTypes.DARK : ThemeTypes.LIGHT;
2026-08-11 06:20:06 +00:00
};
export const hasCustomTheme = function hasCustomTheme(colors) {
2026-10-03 08:58:59 +00:00
return null != colors && colors.colors.length > 0;
2026-08-11 06:20:06 +00:00
};
export const resolveThemeWithCustomSettings = function resolveThemeWithCustomSettings(theme, customUserThemeSettings) {
2026-10-03 08:58:59 +00:00
let tmp2 = theme;
const tmp = null != customUserThemeSettings && customUserThemeSettings.colors.length > 0;
2026-08-11 06:20:06 +00:00
if (tmp) {
2026-10-03 08:58:59 +00:00
const obj = shared;
tmp2 = obj.isThemeDark(theme) ? tmp5.DARK : tmp5.LIGHT;
2026-08-11 06:20:06 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp2;
2026-08-11 06:20:06 +00:00
};
2026-07-20 16:05:17 +00:00
export const getLinearGradientForBackgroundGradient = function getLinearGradientForBackgroundGradient(gradientPreset) {
2026-10-03 08:58:59 +00:00
let angle;
let colors;
2026-07-20 16:05:17 +00:00
({ angle, colors } = gradientPreset);
const mapped = colors.map((item) => {
2026-10-03 08:58:59 +00:00
let stop;
let token;
({ token, stop } = item);
2026-10-03 08:58:59 +00:00
const obj = shims;
return "" + obj.unsafe_getResolvedRawColor(token, { saturation: 1 }) + " " + stop + "%";
2026-07-20 16:05:17 +00:00
});
return "linear-gradient(" + angle + "deg, " + mapped.join(", ") + ")";
};
export const areThemesEqualForGradientThemes = function areThemesEqualForGradientThemes(arg0, arg1) {
let tmp = arg0 === arg1;
if (!tmp) {
let tmp3 = arg0 === ThemeTypes.ASH && arg1 === tmp2.DARK;
2026-07-20 16:05:17 +00:00
if (!tmp3) {
2026-10-03 08:58:59 +00:00
tmp3 = arg0 === ThemeTypes.DARK && arg1 === ThemeTypes.ASH;
2026-07-20 16:05:17 +00:00
}
tmp = tmp3;
}
return tmp;
};
2026-07-29 08:29:29 +00:00
export const getBaseTheme = function getBaseTheme(arg0) {
2026-10-03 08:58:59 +00:00
const tmp = closure_3[arg0];
const obj = shared;
return obj.isThemeDark(tmp) ? ThemeTypes.DARK : ThemeTypes.LIGHT;
2026-07-20 16:05:17 +00:00
};
export const getThemeName = function getThemeName(ASH) {
2026-10-03 08:58:59 +00:00
let closure_0 = ASH;
2026-08-31 15:47:37 +00:00
const found = closure_2.find((theme) => theme.theme === closure_0);
2026-07-29 08:29:29 +00:00
let str;
if (found != null) {
str = found.getName();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
return str;
};