Skip to content
This repository was archived by the owner on May 17, 2025. It is now read-only.

Commit e77e663

Browse files
committed
perf(themes): Draft rawColors normalization since writing directly is insanely slow for some reason
1 parent 5ec4150 commit e77e663

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/lib/addons/themes/colors/parser.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ export function parseColorManifest(manifest: ColorManifest): InternalColorDefini
5656
raw: manifest.main.raw ?? {},
5757
background: manifest.main.background,
5858
};
59-
} else if (manifest.spec === 2) { // is Vendetta theme
59+
}
60+
61+
if (manifest.spec === 2) { // is Vendetta theme
6062
const semanticDefinitions: InternalColorDefinition["semantic"] = {};
6163
const background: InternalColorDefinition["background"] | undefined = manifest.background ? {
6264
...omit(manifest.background, ["alpha"]),
@@ -76,13 +78,16 @@ export function parseColorManifest(manifest: ColorManifest): InternalColorDefini
7678
}
7779

7880
if (manifest.rawColors) {
81+
const draft: typeof manifest.rawColors = {};
82+
7983
for (const key in manifest.rawColors) {
8084
const value = manifest.rawColors[key];
8185
if (!value) continue;
82-
manifest.rawColors[key] = normalizeToHex(value)!;
86+
draft[key] = normalizeToHex(value)!;
8387
}
8488

85-
if (Platform.OS === "android") applyAndroidAlphaKeys(manifest.rawColors);
89+
if (Platform.OS === "android") applyAndroidAlphaKeys(draft);
90+
manifest.rawColors = draft;
8691
}
8792

8893

0 commit comments

Comments
 (0)