Skip to content

Commit

Permalink
onThemeModeChanged
Browse files Browse the repository at this point in the history
  • Loading branch information
YU000jp committed May 16, 2023
1 parent 5ede952 commit a2d4002
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ async function main() {
});


let background;
let color;
let background:string = "unset";
let color:string ="unset";
const rootThemeColor = () => {
const root = parent.document.querySelector(":root");
if (root) {
Expand All @@ -50,7 +50,14 @@ async function main() {
}
};
rootThemeColor();
logseq.App.onThemeModeChanged(() => { rootThemeColor();document.getElementById("app").style.background = background;document.getElementById("app").style.color = color; });
logseq.App.onThemeModeChanged(() => {
rootThemeColor();
const baseStyles: CSS.Properties = {
background,
color,
};
logseq.setMainUIInlineStyle(baseStyles);
});

const baseStyles: CSS.Properties = {
position: "fixed",
Expand Down

0 comments on commit a2d4002

Please sign in to comment.