Fix Matugen Color Extraction from Mode-Based Objects #1130
+178
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #1128
Matugen was returning color objects with mode-based properties (
{dark, default, light}) instead of hex strings when using--json hexflag. ThegetMatugenHex()function expected hex strings but received objects, causing errors like:The function
getMatugenVariations()tried to access properties likematugenColors.primaryexpecting a hex string, but got an object instead.Solution
Added destructuring logic in
generateMatugenColors()to extract hex values from mode-based color objects:darkorlight)defaultif mode-specific color is not availableChanges
src/services/matugen/index.tsgetMatugenHex()clarifying it expects destructured hex stringsenv.d.ts*.gif)src/style/optionsTrackers.tsconnect()method onWallpaperServiceby adding type assertion toGObject.Object.gitignorepnpm-lock.yamlto ignore listTesting
Example
Before (what matugen returns):
{ "colors": { "primary": { "dark": "#4dd0a6", "default": "#4dd0a6", "light": "#006c4c" }, "background": { "dark": "#0f1512", "default": "#0f1512", "light": "#f5fbf6" } } }After (what we pass to getMatugenHex):
{ "primary": "#4dd0a6", // extracted from obj[mode] or obj.default "background": "#0f1512" }