framework7io/framework7 · error · Error
`secondaryDim` color is undefined prior to 2025 spec.
Error message
`secondaryDim` color is undefined prior to 2025 spec.
What it means
Same pattern as primaryDim: the secondaryDim getter is only populated under the 2025 spec. On schemes built for earlier specs, colors.secondaryDim() returns undefined and the getter throws to prevent silently using a missing color.
Source
Thrown at src/core/shared/material-color-utils.js:2297
}
get primaryFixedDim() {
return this.getArgb(this.colors.primaryFixedDim());
}
get onPrimaryFixed() {
return this.getArgb(this.colors.onPrimaryFixed());
}
get onPrimaryFixedVariant() {
return this.getArgb(this.colors.onPrimaryFixedVariant());
}
get inversePrimary() {
return this.getArgb(this.colors.inversePrimary());
}
get secondary() {
return this.getArgb(this.colors.secondary());
}
get secondaryDim() {
const secondaryDim = this.colors.secondaryDim();
if (void 0 === secondaryDim) throw new Error("`secondaryDim` color is undefined prior to 2025 spec.");
return this.getArgb(secondaryDim);
}
get onSecondary() {
return this.getArgb(this.colors.onSecondary());
}
get secondaryContainer() {
return this.getArgb(this.colors.secondaryContainer());
}
get onSecondaryContainer() {
return this.getArgb(this.colors.onSecondaryContainer());
}
get secondaryFixed() {
return this.getArgb(this.colors.secondaryFixed());
}
get secondaryFixedDim() {
return this.getArgb(this.colors.secondaryFixedDim());
}
get onSecondaryFixed() {View on GitHub (pinned to 6557591266)
Solutions
- Construct the scheme with the 2025 spec version.
- Check scheme.specVersion before accessing and fall back to secondary (or compute a dim variant) for older specs.
- Remove the secondaryDim usage if targeting legacy specs.
Example fix
// before const c = legacyScheme.secondaryDim; // throws // after const c = scheme.specVersion === SpecVersion.SPEC_2025 ? scheme.secondaryDim : scheme.secondary;
Defensive patterns
Strategy: type-guard
Validate before calling
function supportsDimRole(scheme, role) {
return String(scheme.specVersion).includes('2025');
}
const c = supportsDimRole(scheme, 'secondaryDim') ? scheme.secondaryDim : scheme.secondary; Type guard
function supports2025Roles(scheme) {
return scheme && scheme.specVersion === '2025';
} Try / catch
try {
argb = scheme.secondaryDim;
} catch (err) {
if (err.message.includes('`secondaryDim` color is undefined')) {
argb = scheme.secondary;
} else throw err;
} Prevention
- Guard all *Dim getters behind a spec-version check helper.
- Construct schemes with explicit specVersion instead of relying on defaults.
- Write a smoke test that reads every role for every scheme used in the app.
When it happens
Trigger: Reading scheme.secondaryDim when the DynamicScheme's specVersion is not 2025, making colors.secondaryDim() undefined.
Common situations: Legacy schemes (specVersion 2021) used with code expecting the expanded 2025 role set; copy-pasted color extraction code referencing newer roles than the scheme supports.
Related errors
- `primaryDim` color is undefined prior to 2025 spec.
- `tertiaryDim` color is undefined prior to 2025 spec.
- Attempting to extend color ${originalColor.name} with color
- Attempting to extend color ${originalColor.name} as a ${orig
- Color ${name} has secondBackgrounddefined, but background is
AI-assisted analysis of framework7io/framework7@6557591266 (2026-09-02).
Data as JSON: /api/errors/c375d65ebdccc69f.
Report an issue: GitHub.