decord/source/modules/client_themes/ClientThemesUtils.tsx

84 lines
3 KiB
TypeScript
Raw Normal View History

2026-08-11 06:20:06 +00:00
// Module ID: 1347
// Function ID: 1348
2026-07-20 16:05:17 +00:00
// Name: getThemeForColor
2026-08-11 06:20:06 +00:00
// Dependencies: [1348, 1305, 505, 1363, 711, 2]
// Exports: areThemesEqualForGradientThemes, getBaseTheme, getCustomThemeBaseTheme, getLinearGradientForBackgroundGradient, getThemeForColor, getThemeName, hasCustomTheme, resolveThemeWithCustomSettings
2026-07-20 16:05:17 +00:00
2026-08-11 06:20:06 +00:00
// Module 1347 (getThemeForColor)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import sum from "sum" /* 505 */;
import SystemThemeState from "SystemThemeState" /* 1305 */;
import AccessibilityAnnouncer from "AccessibilityAnnouncer" /* 1363 */;
import ThemeTypes from "ThemeTypes" /* 1348 */;
2026-07-23 10:11:24 +00:00
2026-08-05 07:35:12 +00:00
({ LEGACY_STANDARD_BACKGROUND_THEMES: obj1, REFRESH_STANDARD_BACKGROUND_THEMES: c3 } = ThemeTypes);
2026-08-24 06:08:38 +00:00
let closure_4 = SystemThemeState.PROTO_THEME_MAP_WEB_REFRESH;
ThemeTypes = sum.ThemeTypes;
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
};
export const getThemeName = function getThemeName(DARK, closure_1) {
2026-08-24 06:08:38 +00:00
closure_0 = DARK;
2026-07-23 10:11:24 +00:00
const found = closure_1 ? closure_3 : 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;
};