Skip to content

Commit d860c5b

Browse files
committed
web: editor dark theme support
1 parent a966c6e commit d860c5b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

web/src/editor.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,18 @@ end
99
1010
`;
1111

12+
const THEMES = {
13+
light: "vs-light",
14+
dark: "hc-black",
15+
};
16+
1217
export const init = (target, opts) => {
18+
const theme = window.matchMedia?.("(prefers-color-scheme: dark)").matches
19+
? "dark"
20+
: "light";
21+
1322
return monaco.editor.create(target, {
23+
theme: THEMES[theme],
1424
value: DEFAULT_CODE,
1525
language: "ruby",
1626
automaticLayout: true,

web/src/game.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Game {
7878
}
7979

8080
get playerrb() {
81-
return this.vm.eval(`File.read("${this.gameDir}/player.rb")`).toString();
81+
return this.vm.eval(`File.read("${this.gameDir}/player.rb")`).toString().replace(/\n+$/, '\n');
8282
}
8383

8484
get profile() {

0 commit comments

Comments
 (0)