Preact: Support custom colors (#2385)
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run

This commit is contained in:
Mia 2025-04-20 17:48:55 -05:00 committed by GitHub
parent dbff485823
commit 48cb201300
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,7 @@ import type { Battle } from './battle';
import type { BattleScene } from './battle-animations';
import { Dex, Teams, toID, toRoomid, toUserid, type ID } from './battle-dex';
import { BattleTextParser, type Args, type KWArgs } from './battle-text-parser';
import { Net } from './client-connection'; // optional
// Caja
declare const html4: any;
@ -1784,3 +1785,10 @@ export class BattleLog {
return 'data:text/plain;base64,' + encodeURIComponent(btoa(unescape(encodeURIComponent(replayFile))));
}
}
if (window.Net) {
Net(`/config/colors.json`).get().then(response => {
const data = JSON.parse(response);
Object.assign(Config.customcolors, data);
}).catch(() => {});
}