Skip to content

Commit

Permalink
perf(themes): Draft rawColors normalization since writing directly is…
Browse files Browse the repository at this point in the history
… insanely slow for some reason
  • Loading branch information
pylixonly committed Jan 28, 2025
1 parent 5ec4150 commit e77e663
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/lib/addons/themes/colors/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export function parseColorManifest(manifest: ColorManifest): InternalColorDefini
raw: manifest.main.raw ?? {},
background: manifest.main.background,
};
} else if (manifest.spec === 2) { // is Vendetta theme
}

if (manifest.spec === 2) { // is Vendetta theme
const semanticDefinitions: InternalColorDefinition["semantic"] = {};
const background: InternalColorDefinition["background"] | undefined = manifest.background ? {
...omit(manifest.background, ["alpha"]),
Expand All @@ -76,13 +78,16 @@ export function parseColorManifest(manifest: ColorManifest): InternalColorDefini
}

if (manifest.rawColors) {
const draft: typeof manifest.rawColors = {};

for (const key in manifest.rawColors) {
const value = manifest.rawColors[key];
if (!value) continue;
manifest.rawColors[key] = normalizeToHex(value)!;
draft[key] = normalizeToHex(value)!;
}

if (Platform.OS === "android") applyAndroidAlphaKeys(manifest.rawColors);
if (Platform.OS === "android") applyAndroidAlphaKeys(draft);
manifest.rawColors = draft;
}


Expand Down

0 comments on commit e77e663

Please sign in to comment.