With $THIS being the folder that contains this SKILL.md:
Prerequisite
$THIS/node_modules/ exists and is not older than 7 days; if not: cd $THIS && npm ci
Context
Design Tokens are defined in LESS files of the theming-base-content, and consumed in LESS and CSS files of different frameworks (= UI technologies). In $THIS/node_modules/ you find the following:
- UI5: (with
$LIBRARYbeing e.g.sap.ui.core, and$THEMEbeing e.g.sap_horizon)$THIS/node_modules/@openui5/$LIBRARY/src/${LIBRARY/./\//}/**/themes/basecontains thebaseThemeof the different libraries$THIS/node_modules/@openui5/themelib_$THEME/src/${LIBRARY/./\//}/themes/contains the$THEMEof the different libraries
- UI5 Web Components: (with
$THEMEbeing e.g.sap_horizon, and$COMPONENTbeing e.g.Button)$THIS/node_modules/@ui5/*/src/themes/$COMPONENT.csscontains theme-independent component skeleton CSS, using parameters from theming-base-content as CSS custom properties, as well as CSS custom properties defined inbase/(see below)$THIS/node_modules/@ui5/*/src/themes/base/$COMPONENT-parameters.csscontains CSS custom property definitions for components; never report those UI5 Web Components-specific internal CSS custom properties.$THIS/node_modules/@ui5/*/src/themes/$THEME/$COMPONENT-parameters.csscontains theme-dependent values for the custom property definitions frombase/(see above)
- Fundamental Styles:
$THIS/node_modules/fundamental-styles/dist/*.csscontains theme-independent component skeleton CSS, using parameters from theming-base-content as CSS custom properties, as well as CSS custom properties defined intheming/(see below)$THIS/node_modules/fundamental-styles/dist/theming/$THEME.csscontains theme-dependent values for the custom property definitions used indist/*.css(see above); never report those Fundamental Styles-specific internal CSS custom properties$THIS/node_modules/@fundamental-styles/common-css/dist/*.csstheme-independent helper CSS, using parameters from theming-base-content as CSS custom properties
- Base: (with
$LIBRARYbeing e.g.baseLib, and$THEMEbeing e.g.sap_horizon)$THIS/node_modules/@sap-theming/theming-base-content/contentis a theme repository as described in https://raw.githubusercontent.com/SAP-docs/btp-ui-theme-designer/main/docs/cf/About-Themes/overview-of-sap-theming-content-91ebfe2.md, containingBase/; used by all frameworks$THIS/node_modules/@sap-theming/theming-base-content/content/Base/.themingcontains metadata about theBaseframework$THIS/node_modules/@sap-theming/theming-base-content/content/Base/$LIBRARY/.themingcontains metadata about libraries$THIS/node_modules/@sap-theming/theming-base-content/content/Base/$LIBRARY/$THEME/.themingcontains metadata about themes- Metadata includes
sEntity: "Framework", "Library" or "Theme"sType(for themes): "STANDARD" (= single theme) or "SET" (= no CSS, just references to different themes ofsType=STANDARD)aFiles: LESS source filesaBuildFiles: CSS files built fromaFiles*sBase{Library,Theme,File}Id: ID of the most important library/theme/fileoExtends: the$FRAMEWORK[.$LIBRARY[.$THEME[.$FILE]]]"object path" of the parent entitysSourcePathPattern: pattern to resolve object paths to file paths- (optional)
bIgnore=true: entity is ignored from theming
- Alongside the LESS sources and
.themingmetadata, a theme dir under.../baseLib/$THEME/also ships fully-resolved parameter values built from the LESS chain — use these for resolved-value lookups instead of evaluating LESS:css_variables.css— resolved values as CSS custom properties (e.g.--sapBrandColor: #0070f2;); widest theme coverage, the preferred resolved-value sourceless_variables.less— the same resolved values as LESS variables (e.g.@sapBrandColor: #0070f2;)variables.json— the same resolved values as JSON (e.g."sapBrandColor": "#0070f2")design-tokens.json— a token'stype,description, and derivation graph only; its colorvaluefields are HSLA references (e.g.hsla({Main._sapBrandColorH}, …)), not final values — not a resolved-value source
Procedure
- Determine the SAP theme the users question targets, present the available theme IDs from
$THIS/node_modules/@sap-theming/theming-base-content/content/Base/baseLibas select options if unclear, default tosap_horizon - Determine the framework the user's question targets. Present the frameworks from "Context" as select options if unclear, applying these defaults:
- framework stated: use that
- component stated, no framework:
- search UI5 Web Components for a CSS file for the component; if found use UI5 Web Components as primary source
- additionally search Base for parameters matching
sap$COMPONENT_*: report any such parameters not already referenced in UI5 Web Components as supplementary, labelled "defined in theming-base-content, not yet referenced in UI5 Web Components CSS"
- no component, no framework: use Base
- Read the
.themingfile of the framework the users question targets, determinesBaseLibraryIdandsSourcePathPattern - Read the
.themingfile of the theme of thesBaseLibraryof the framework the users question targets, based onsSourcePathPatternof the frameworks.themingfile - While there is an
oExtends:- Read the
.themingfile of the theme referenced byoExtends; if you haven't encountered the framework (the first section of the Object Path) before, read the framework.themingfirst to determine itssSourcePathPattern - Merge the
.themingJSON with what you already have from the theme.themingfiles: if a key already exists, leave it untouched; add key+value if the key does not yet exist
- Read the
- If the question only needs the resolved value of one or more parameters in the theme (e.g. "what value does
sapButton_Backgroundhave insap_horizon?"), read the theme's flat, pre-resolved artifact from$THIS/node_modules/@sap-theming/theming-base-content/content/Base/baseLib/<theme>/and take the value directly — prefercss_variables.css(--sapButton_Background: #fff;, widest theme coverage), or equivalentlyless_variables.less(@sapButton_Background: #fff;) orvariables.json("sapButton_Background": "#fff"). Do not readdesign-tokens.jsonfor values (its colorvaluefields are HSLA references such ashsla({Main._sapBrandColorH}, …), not final values). The LESS traversal in steps 7–8 is not needed for a plain value lookup. - Otherwise, when inheritance or annotation semantics are needed, build the merged LESS: read the
${sBaseFileId}.lessfile (sBaseFileIdcomes from the merged.themingfiles) of the theme of thesBaseLibraryof the framework the users question targets, then for each LESS@importstatement, recursively:- Read the referenced LESS file
- Replace the
@importstatement with the read content
- In the merged LESS file, map the lines
// [<Annotation> <required: Value> <optional: More Values>]that precede parameter definitions to that parameter:- If a parameter is defined multiple times, merge those annotations
- If an annotation already exists: append the value to the existing annotation values
- If an annotation has values for which it also has "anti-values" (the same value but starting with a
!, e.g. "Protected" and "!Protected"), remove both values from the values list - If an annotation values list is empty, remove the annotation
- If the user targets "UI5 Web Components", for each relevant component look up the three CSS sources:
- the theme-independent skeleton at
@ui5/*/src/themes/<Component>.css, merged with - the always-used base parameters at
@ui5/*/src/themes/base/<Component>-parameters.css, then with - the theme-specific delta at
@ui5/*/src/themes/<theme>/<Component>-parameters.css
- the theme-independent skeleton at
- If the user targets "Fundamental Styles", scan
fundamental-styles/dist/*.cssfor the relevant component; theme-specific values come from the CSS custom properties intheming-base-content/content/Base/baseLib/<theme>/css_variables.css(standardsap*parameters), merged withfundamental-styles/dist/theming/<theme>.css(Fundamental Styles-specific tokens not present in theming-base-content, e.g.sapMenu_*,sapNavigation_*) - Answer the users question based on the information collected