Skip to content

Commit 2dc10a5

Browse files
authored
Use theme from compiled script if available (microsoft#11556)
* Use theme from compiled script if available * Account for single string themes
1 parent b1dcfc2 commit 2dc10a5

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎localtypings/pxtarget.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,7 @@ declare namespace ts.pxtc {
11861186
usedBuiltinParts?: string[];
11871187
allParts?: string[];
11881188
breakpoints?: number[];
1189+
theme?: string | pxt.Map<string>;
11891190
}
11901191

11911192
interface UpgradePolicy {

‎pxtrunner/runner.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ function initDriverAndOptions(
431431
} = compileInfo || {};
432432
let board = pxt.appTarget.simulator.boardDefinition;
433433
let storedState: pxt.Map<string> = getStoredState(simOptions.id)
434+
let theme: string | pxt.Map<string> = mainPkg.config?.theme ?? compileInfo?.theme;
434435
let runOptions: pxsim.SimulatorRunOptions = {
435436
debug: simOptions.debug,
436437
mute: simOptions.mute,
@@ -449,7 +450,7 @@ function initDriverAndOptions(
449450
autofocus: simOptions.autofocus,
450451
queryParameters: simOptions.additionalQueryParameters,
451452
mpRole: simOptions.mpRole,
452-
theme: mainPkg.config?.theme,
453+
theme,
453454
};
454455
if (pxt.appTarget.simulator && !simOptions.fullScreen)
455456
runOptions.aspectRatio = parts.length && pxt.appTarget.simulator.partsAspectRatio

0 commit comments

Comments
 (0)