decord/source/modules/client_themes/ClientThemesUtils.tsx

86 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-05 07:35:12 +00:00
import ThemeTypes from "ThemeTypes";
2026-08-11 06:20:06 +00:00
import { PROTO_THEME_MAP_WEB_REFRESH as closure_4 } from "SystemThemeState";
2026-07-23 10:11:24 +00:00
import { ThemeTypes } from "sum";
2026-07-29 08:29:29 +00:00
let c3;
let obj1;
2026-08-05 07:35:12 +00:00
({ LEGACY_STANDARD_BACKGROUND_THEMES: obj1, REFRESH_STANDARD_BACKGROUND_THEMES: c3 } = ThemeTypes);
2026-07-23 10:11:24 +00:00
const result = require("sum").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) {
return require(1363) /* AccessibilityAnnouncer */.isThemeDark(theme) ? ThemeTypes.DARKER : ThemeTypes.LIGHT;
};
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 {
require(1363) /* AccessibilityAnnouncer */.isThemeDark(theme) ? ThemeTypes.DARKER : ThemeTypes.LIGHT;
const obj = require(1363) /* AccessibilityAnnouncer */;
}
};
2026-07-20 16:05:17 +00:00
export const getLinearGradientForBackgroundGradient = function getLinearGradientForBackgroundGradient(gradientPreset) {
let angle;
let colors;
({ angle, colors } = gradientPreset);
const mapped = colors.map((arg0) => {
let stop;
let token;
({ 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-11 06:20:06 +00:00
return require(1363) /* 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-07-23 10:11:24 +00:00
let closure_0 = DARK;
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;
};