MCPcopy Create free account
hub / github.com/UI5/webcomponents / detectExternalTheme

Function detectExternalTheme

packages/base/src/theming/applyTheme.ts:61–83  ·  view source on GitHub ↗
(theme: string)

Source from the content-addressed store, hash-verified

59};
60
61const detectExternalTheme = async (theme: string) => {
62 // If theme designer theme is detected, use this
63 const extTheme = getThemeDesignerTheme();
64 if (extTheme) {
65 return extTheme;
66 }
67
68 // If OpenUI5Support is enabled, try to find out if it loaded variables
69 const openUI5Support = getFeature<typeof OpenUI5Support>("OpenUI5Support");
70 if (openUI5Support && openUI5Support.isOpenUI5Detected()) {
71 const varsLoaded = openUI5Support.cssVariablesLoaded();
72 if (varsLoaded) {
73 return {
74 themeName: openUI5Support.getConfigurationSettingsObject()?.theme, // just themeName
75 baseThemeName: "", // baseThemeName is only relevant for custom themes
76 };
77 }
78 } else if (getThemeRoot()) {
79 await attachCustomThemeStylesToHead(theme);
80
81 return getThemeDesignerTheme();
82 }
83};
84
85const applyTheme = async (theme: string) => {
86 const extTheme = await detectExternalTheme(theme);

Callers 1

applyThemeFunction · 0.85

Calls 7

getThemeDesignerThemeFunction · 0.85
getFeatureFunction · 0.85
isOpenUI5DetectedMethod · 0.80
cssVariablesLoadedMethod · 0.80
getThemeRootFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…