add: support dark mode

This commit is contained in:
windingwind 2023-11-29 21:43:33 +08:00
parent 6f6f1b7ba1
commit b909f1cd19
9 changed files with 1231 additions and 22 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
<link
rel="stylesheet"
type="text/css"
href="chrome://__addonRef__/content/lib/css/github-markdown-light.min.css"
href="chrome://__addonRef__/content/lib/css/github-markdown.css"
/>
<link
rel="stylesheet"

View File

@ -24,7 +24,6 @@
overflow-x: hidden;
overflow-y: auto;
word-wrap: break-word;
background-color: #f0f0f0;
}
.viewport {
margin: 0 5px 0 5px;
@ -47,7 +46,6 @@
display: flex;
flex-direction: column;
overflow: hidden;
background-color: #f0f0f0;
}
.title-container {
padding: 5px;
@ -57,7 +55,6 @@
display: flex;
flex-direction: row;
overflow: hidden;
background-image: linear-gradient(to top, #f8f8f8, #f9f9f9);
border: solid 0.5px #aaaaaa;
}
.title-text {
@ -71,7 +68,6 @@
display: flex;
flex-direction: row;
overflow: hidden;
background-color: #f0f0f0;
}
.footer-container {
padding: 5px;
@ -81,7 +77,6 @@
display: flex;
flex-direction: row;
overflow: hidden;
background-color: #f0f0f0;
}
.added {
background-color: rgb(230, 255, 236);
@ -198,7 +193,7 @@
<div
class="dx-viewport viewport"
id="outline-container"
style="background-color: #ffffff; width: calc(20% - 10px)"
style="width: calc(20% - 10px)"
>
<div class="demo-container">
<div id="list-demo">
@ -211,7 +206,6 @@
<div
class="diff-viewport viewport"
style="
background-color: #ffffff;
width: calc(30% - 10px);
padding: 10px 30px 10px 30px;
"
@ -219,7 +213,6 @@
<div
class="render-viewport viewport primary-editor ProseMirror"
style="
background-color: #ffffff;
width: calc(50% - 10px);
padding: 10px 30px 10px 30px;
"

View File

@ -52,7 +52,6 @@
overflow-x: hidden;
overflow-y: auto;
word-wrap: break-word;
background-color: #f0f0f0;
font-family: initial;
}
.viewport {
@ -66,11 +65,9 @@
display: flex;
flex-direction: row;
overflow: hidden;
background-color: #f0f0f0;
}
.list-viewport {
width: 100%;
background-color: #ffffff;
overflow: hidden;
}
#table-container {

View File

@ -53,7 +53,6 @@
overflow-x: hidden;
overflow-y: auto;
word-wrap: break-word;
background-color: #f0f0f0;
font-family: initial;
}
.viewport {
@ -67,16 +66,13 @@
display: flex;
flex-direction: row;
overflow: hidden;
background-color: #f0f0f0;
}
.footer-container {
padding: 5px;
background-color: #f0f0f0;
}
.list-viewport {
width: calc(20% - 10px);
height: 100%;
background-color: #ffffff;
overflow: hidden;
}
#table-container {
@ -107,7 +103,7 @@
<link
rel="stylesheet"
type="text/css"
href="chrome://__addonRef__/content/lib/css/github-markdown-light.min.css"
href="chrome://__addonRef__/content/lib/css/github-markdown.css"
/>
<link rel="localization" href="__addonRef__-templateEditor.ftl" />
</head>

View File

@ -72,7 +72,6 @@
overflow-x: hidden;
overflow-y: auto;
word-wrap: break-word;
background-color: #f0f0f0;
font-family: initial;
}
#workspace-container {
@ -81,7 +80,6 @@
height: 100%;
width: 100%;
overflow: hidden;
background-color: #f0f0f0;
}
</style>
<link rel="localization" href="__addonRef__-workspaceWindow.ftl" />

View File

@ -114,7 +114,7 @@ export async function showSyncDiff(noteId: number, mdPath: string) {
switch (io.type) {
case "skip":
alert(
window.alert(
`Syncing of "${noteItem.getNoteTitle()}" is skipped.\nTo sync manually, go to File->Better Notes Sync Manager.`,
);
addon.data.sync.diff.window?.closed ||

View File

@ -128,9 +128,11 @@ export async function showTemplateEditor() {
const editorWin = (_window.document.querySelector("#editor") as any)
.contentWindow;
await waitUtilAsync(() => editorWin?.loadMonaco);
const isDark = editorWin?.matchMedia("(prefers-color-scheme: dark)")
.matches;
const { monaco, editor } = await editorWin.loadMonaco({
language: "javascript",
theme: "vs-light",
theme: "vs-" + (isDark ? "dark" : "light"),
});
addon.data.template.editor.editor = editor;
}