{"record":{"id":"b29a4b6a19bfb16b","repo":"framework7io/framework7","slug":"errordim-color-is-undefined-prior-to-2025-spec","errorCode":null,"errorMessage":"`errorDim` color is undefined prior to 2025 spec.","messagePattern":"`errorDim` color is undefined prior to 2025 spec\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/core/shared/material-color-utils.js","lineNumber":2355,"sourceCode":"  }\n  get tertiaryFixed() {\n    return this.getArgb(this.colors.tertiaryFixed());\n  }\n  get tertiaryFixedDim() {\n    return this.getArgb(this.colors.tertiaryFixedDim());\n  }\n  get onTertiaryFixed() {\n    return this.getArgb(this.colors.onTertiaryFixed());\n  }\n  get onTertiaryFixedVariant() {\n    return this.getArgb(this.colors.onTertiaryFixedVariant());\n  }\n  get error() {\n    return this.getArgb(this.colors.error());\n  }\n  get errorDim() {\n    const errorDim = this.colors.errorDim();\n    if (void 0 === errorDim) throw new Error(\"`errorDim` color is undefined prior to 2025 spec.\");\n    return this.getArgb(errorDim);\n  }\n  get onError() {\n    return this.getArgb(this.colors.onError());\n  }\n  get errorContainer() {\n    return this.getArgb(this.colors.errorContainer());\n  }\n  get onErrorContainer() {\n    return this.getArgb(this.colors.onErrorContainer());\n  }\n}\n\nDynamicScheme.DEFAULT_SPEC_VERSION = \"2021\", DynamicScheme.DEFAULT_PLATFORM = \"phone\";\n\nclass DynamicSchemePalettesDelegateImpl2021 {\n  getPrimaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {\n    switch (variant) {","sourceCodeStart":2337,"sourceCodeEnd":2373,"githubUrl":"https://github.com/framework7io/framework7/blob/655759126686766530a027b2f8f369c991d63d1c/src/core/shared/material-color-utils.js#L2337-L2373","documentation":"DynamicScheme exposes an `errorDim` ARGB getter, but the underlying palette delegate only defines an errorDim color for the 2025 Material color spec. In the 2021 spec `this.colors.errorDim()` returns undefined, so the getter explicitly throws this error rather than silently returning NaN. It is a guard against accessing a 2025-only color token on a pre-2025 scheme.","triggerScenarios":"Reading `scheme.errorDim` (or any code path that reads it, e.g. serializing all scheme colors) when the scheme was created with spec version 2021 or with a Variant/delegate that does not define errorDim — `this.colors.errorDim()` returns undefined.","commonSituations":"Apps upgraded Material theme libraries and iterate every token generically; code copied from 2025-spec examples run against 2021 schemes; schemes built with `specVersion: '2021'` (or default 2021) while UI code expects 2025 tokens.","solutions":["Switch the scheme to the 2025 spec (construct DynamicScheme/dynamic color with the 2025 spec version / 2025 variant) so errorDim is defined.","If you must stay on the 2021 spec, stop reading scheme.errorDim; fall back to a computed darkened error color instead.","Feature-check before access: only read errorDim when the scheme's spec/version supports it."],"exampleFix":"// before\nconst dim = scheme.errorDim; // throws on 2021 spec\n// after\nconst dim = scheme.errorDim !== undefined ? scheme.errorDim : scheme.error; // or use a 2025-spec scheme","handlingStrategy":"validation","validationCode":"function supportsErrorDim(scheme) {\n  return typeof scheme?.colors?.errorDim === 'function' && scheme.colors.errorDim() !== undefined;\n}\n// usage: const dim = supportsErrorDim(scheme) ? scheme.errorDim : scheme.error;","typeGuard":"function hasErrorDim(scheme) {\n  return !!scheme && typeof scheme.colors === 'object' && scheme.colors.errorDim() !== undefined;\n}","tryCatchPattern":"let dim;\ntry {\n  dim = scheme.errorDim;\n} catch (e) {\n  if (e.message.includes('errorDim')) dim = scheme.error; // 2021-spec fallback\n  else throw e;\n}","preventionTips":["Only read errorDim when the scheme is built with the 2025 spec.","Never iterate all scheme getters generically across spec versions.","Centralize color-token access in a helper that feature-checks per spec version.","Pin the spec version in one place and derive token availability from it."],"tags":["material-color","undefined-color","spec-version"],"backgroundTag":"undefined-color-token","analyzedSha":"655759126686766530a027b2f8f369c991d63d1c","analyzedAt":"2026-09-02T19:48:40.711Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}