{"record":{"id":"c375d65ebdccc69f","repo":"framework7io/framework7","slug":"secondarydim-color-is-undefined-prior-to-2025-sp","errorCode":null,"errorMessage":"`secondaryDim` color is undefined prior to 2025 spec.","messagePattern":"`secondaryDim` color is undefined prior to 2025 spec\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/core/shared/material-color-utils.js","lineNumber":2297,"sourceCode":"  }\n  get primaryFixedDim() {\n    return this.getArgb(this.colors.primaryFixedDim());\n  }\n  get onPrimaryFixed() {\n    return this.getArgb(this.colors.onPrimaryFixed());\n  }\n  get onPrimaryFixedVariant() {\n    return this.getArgb(this.colors.onPrimaryFixedVariant());\n  }\n  get inversePrimary() {\n    return this.getArgb(this.colors.inversePrimary());\n  }\n  get secondary() {\n    return this.getArgb(this.colors.secondary());\n  }\n  get secondaryDim() {\n    const secondaryDim = this.colors.secondaryDim();\n    if (void 0 === secondaryDim) throw new Error(\"`secondaryDim` color is undefined prior to 2025 spec.\");\n    return this.getArgb(secondaryDim);\n  }\n  get onSecondary() {\n    return this.getArgb(this.colors.onSecondary());\n  }\n  get secondaryContainer() {\n    return this.getArgb(this.colors.secondaryContainer());\n  }\n  get onSecondaryContainer() {\n    return this.getArgb(this.colors.onSecondaryContainer());\n  }\n  get secondaryFixed() {\n    return this.getArgb(this.colors.secondaryFixed());\n  }\n  get secondaryFixedDim() {\n    return this.getArgb(this.colors.secondaryFixedDim());\n  }\n  get onSecondaryFixed() {","sourceCodeStart":2279,"sourceCodeEnd":2315,"githubUrl":"https://github.com/framework7io/framework7/blob/655759126686766530a027b2f8f369c991d63d1c/src/core/shared/material-color-utils.js#L2279-L2315","documentation":"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.","triggerScenarios":"Reading scheme.secondaryDim when the DynamicScheme's specVersion is not 2025, making colors.secondaryDim() undefined.","commonSituations":"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.","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."],"exampleFix":"// before\nconst c = legacyScheme.secondaryDim; // throws\n// after\nconst c = scheme.specVersion === SpecVersion.SPEC_2025 ? scheme.secondaryDim : scheme.secondary;","handlingStrategy":"type-guard","validationCode":"function supportsDimRole(scheme, role) {\n  return String(scheme.specVersion).includes('2025');\n}\nconst c = supportsDimRole(scheme, 'secondaryDim') ? scheme.secondaryDim : scheme.secondary;","typeGuard":"function supports2025Roles(scheme) {\n  return scheme && scheme.specVersion === '2025';\n}","tryCatchPattern":"try {\n  argb = scheme.secondaryDim;\n} catch (err) {\n  if (err.message.includes('`secondaryDim` color is undefined')) {\n    argb = scheme.secondary;\n  } else throw err;\n}","preventionTips":["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."],"tags":["material-design","color","dynamic-scheme","spec-version"],"backgroundTag":"color-role-unsupported-spec-version","analyzedSha":"655759126686766530a027b2f8f369c991d63d1c","analyzedAt":"2026-09-02T19:48:40.711Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}