{"record":{"id":"ab0f784e845eb57a","repo":"framework7io/framework7","slug":"primarydim-color-is-undefined-prior-to-2025-spec","errorCode":null,"errorMessage":"`primaryDim` color is undefined prior to 2025 spec.","messagePattern":"`primaryDim` color is undefined prior to 2025 spec\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/core/shared/material-color-utils.js","lineNumber":2265,"sourceCode":"  }\n  get outlineVariant() {\n    return this.getArgb(this.colors.outlineVariant());\n  }\n  get shadow() {\n    return this.getArgb(this.colors.shadow());\n  }\n  get scrim() {\n    return this.getArgb(this.colors.scrim());\n  }\n  get surfaceTint() {\n    return this.getArgb(this.colors.surfaceTint());\n  }\n  get primary() {\n    return this.getArgb(this.colors.primary());\n  }\n  get primaryDim() {\n    const primaryDim = this.colors.primaryDim();\n    if (void 0 === primaryDim) throw new Error(\"`primaryDim` color is undefined prior to 2025 spec.\");\n    return this.getArgb(primaryDim);\n  }\n  get onPrimary() {\n    return this.getArgb(this.colors.onPrimary());\n  }\n  get primaryContainer() {\n    return this.getArgb(this.colors.primaryContainer());\n  }\n  get onPrimaryContainer() {\n    return this.getArgb(this.colors.onPrimaryContainer());\n  }\n  get primaryFixed() {\n    return this.getArgb(this.colors.primaryFixed());\n  }\n  get primaryFixedDim() {\n    return this.getArgb(this.colors.primaryFixedDim());\n  }\n  get onPrimaryFixed() {","sourceCodeStart":2247,"sourceCodeEnd":2283,"githubUrl":"https://github.com/framework7io/framework7/blob/655759126686766530a027b2f8f369c991d63d1c/src/core/shared/material-color-utils.js#L2247-L2283","documentation":"The DynamicScheme getter primaryDim exists only for the 2025 (expressive) spec; for earlier spec versions the underlying colors.primaryDim() returns undefined. The getter throws instead of returning a wrong color, telling the caller this role is not available prior to the 2025 spec.","triggerScenarios":"Accessing scheme.primaryDim on a DynamicScheme constructed with specVersion 2021 (default) or otherwise without 2025 support, where colors.primaryDim() evaluates to undefined.","commonSituations":"Code written against the 2025 spec run with a scheme built via a constructor defaulting to specVersion 2021; upgrading material-color-utils and referencing new dim roles while still creating legacy schemes.","solutions":["Create the scheme with specVersion set to 2025 (e.g. pass SpecVersion.SPEC_2025 / use the 2025 constructor) before reading primaryDim.","Guard the access with a specVersion check and fall back to a computed dim tone for older specs.","If the dim variant is not needed, use scheme.primary instead."],"exampleFix":"// before\nconst scheme = new DynamicScheme(...); // specVersion 2021\nconst c = scheme.primaryDim;\n// after\nconst scheme = new DynamicScheme({ ..., specVersion: SpecVersion.SPEC_2025 });\nconst c = scheme.primaryDim;","handlingStrategy":"type-guard","validationCode":"function canReadDim(scheme) {\n  return scheme.specVersion != null && String(scheme.specVersion).includes('2025');\n}\nconst c = canReadDim(scheme) ? scheme.primaryDim : null;","typeGuard":"function supports2025Roles(scheme) {\n  return scheme && scheme.specVersion === '2025';\n}","tryCatchPattern":"try {\n  argb = scheme.primaryDim;\n} catch (err) {\n  if (err.message.includes('`primaryDim` color is undefined')) {\n    argb = scheme.primary; // fallback for pre-2025 specs\n  } else throw err;\n}","preventionTips":["Pin scheme construction to the spec version whose roles you read.","Centralize role access behind helpers that know the spec version.","When upgrading to 2025 roles, upgrade scheme creation everywhere in the same change."],"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"}