decord/source/modules/client_themes/ClientThemesUtils.tsx

84 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-09-02 09:53:35 +00:00
// Module ID: 1346
// Function ID: 1347
2026-07-20 16:05:17 +00:00
// Name: getThemeForColor
2026-09-02 09:53:35 +00:00
// Dependencies: [1347, 1304, 502, 1362, 708, 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-09-02 09:53:35 +00:00
// Module 1346 (getThemeForColor)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
2026-09-02 09:53:35 +00:00
import sum from "sum" /* 502 */;
import SystemThemeState from "SystemThemeState" /* 1304 */;
import ThemeTypes2 from "ThemeTypes" /* 1347 */;
import AccessibilityAnnouncer from "AccessibilityAnnouncer" /* 1362 */;
2026-07-23 10:11:24 +00:00
2026-08-31 15:47:37 +00:00
let closure_2 = ThemeTypes2.REFRESH_STANDARD_BACKGROUND_THEMES;
let closure_3 = SystemThemeState.PROTO_THEME_MAP_WEB_REFRESH;
const ThemeTypes = sum.ThemeTypes;
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/client_themes/ClientThemesUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getThemeForColor = function getThemeForColor(l) {
if (l.l <= 0.3) {
2026-08-11 06:20:06 +00:00
let LIGHT = ThemeTypes.DARKER;
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-08-24 06:08:38 +00:00
return AccessibilityAnnouncer.isThemeDark(theme) ? ThemeTypes.DARKER : ThemeTypes.LIGHT;
2026-08-11 06:20:06 +00:00
};
export const hasCustomTheme = function hasCustomTheme(colors) {
let tmp = null != colors;
if (tmp) {
tmp = colors.colors.length > 0;
}
return tmp;
};
export const resolveThemeWithCustomSettings = function resolveThemeWithCustomSettings(theme, customUserThemeSettings) {
let tmp = null != customUserThemeSettings;
if (tmp) {
tmp = customUserThemeSettings.colors.length > 0;
}
if (!tmp) {
return theme;
} else {
2026-08-24 06:08:38 +00:00
AccessibilityAnnouncer.isThemeDark(theme) ? ThemeTypes.DARKER : ThemeTypes.LIGHT;
const obj = AccessibilityAnnouncer;
2026-08-11 06:20:06 +00:00
}
};
2026-07-20 16:05:17 +00:00
export const getLinearGradientForBackgroundGradient = function getLinearGradientForBackgroundGradient(gradientPreset) {
({ angle, colors } = gradientPreset);
const mapped = colors.map((arg0) => {
({ token, stop } = arg0);
2026-08-11 06:20:06 +00:00
return "" + callback(table[4]).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) {
2026-07-29 08:29:29 +00:00
let tmp3 = arg0 === ThemeTypes.DARK && arg1 === tmp2.DARKER;
2026-07-20 16:05:17 +00:00
if (!tmp3) {
2026-07-29 08:29:29 +00:00
tmp3 = arg0 === tmp2.DARKER && arg1 === tmp2.DARK;
const tmp4 = arg0 === tmp2.DARKER && arg1 === tmp2.DARK;
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-08-24 06:08:38 +00:00
return AccessibilityAnnouncer.isThemeDark(table[arg0]) ? ThemeTypes.DARKER : ThemeTypes.LIGHT;
2026-07-20 16:05:17 +00:00
};
2026-08-31 15:47:37 +00:00
export const getThemeName = function getThemeName(DARK) {
2026-08-24 06:08:38 +00:00
closure_0 = DARK;
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;
};