Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix color theme base
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch committed Jun 21, 2023
1 parent 351fc23 commit d3ee765
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 108 deletions.
10 changes: 5 additions & 5 deletions docs/assets/js/inject-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function escapeHtml(unsafe) {
.replace(/'/g, "'");
}

function getTheme() {
function getTheme(userTheme) {
const styles = getComputedStyle(document.querySelector("#page"));

const format = str => str.trim().substring(1, 9);
Expand Down Expand Up @@ -58,7 +58,7 @@ function getTheme() {
{ token: "string", foreground: text4 },
{ token: "keyword", foreground: text6 }
];
const base = userColorTheme === "light" ? "vs" : "vs-dark";
const base = userTheme === "light" ? "vs" : "vs-dark";
return {
base,
colors: {
Expand All @@ -78,7 +78,7 @@ function getTheme() {
const newTheme = e.target.checked === true ? "light" : "dark";
localStorage.setItem("theme", newTheme);
document.documentElement.setAttribute("data-theme", newTheme);
monaco.editor.defineTheme("ganache", getTheme());
monaco.editor.defineTheme("ganache", getTheme(newTheme));
});
})();

Expand Down Expand Up @@ -106,9 +106,9 @@ require(["vs/editor/editor.main"], function () {
const libUri = "ts:filename/provider.d.ts";
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
monaco.editor.createModel(libSource, "typescript", monaco.Uri.parse(libUri));
monaco.editor.defineTheme("ganache", getTheme());
monaco.editor.defineTheme("ganache", getTheme(userColorTheme));

const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
const AsyncFunction = Object.getPrototypeOf(async function () { }).constructor;
let ganachePromise = null;
async function downloadGanacheIfNeeded() {
if (Ganache) return;
Expand Down
Loading

0 comments on commit d3ee765

Please sign in to comment.