Skip to content

Commit

Permalink
#app background(CSS)
Browse files Browse the repository at this point in the history
  • Loading branch information
YU000jp authored May 16, 2023
1 parent eaecc3e commit 515f3f1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,30 @@ function createModel() {

async function main() {
const app = new App({
target: document.getElementById("app"),
target: document.getElementById("app") as Element,
});


let background;
let color;
const rootThemeColor = () => {
const root = parent.document.querySelector(":root");
if (root) {
const rootStyles = getComputedStyle(root);
background = rootStyles.getPropertyValue("--ls-primary-background-color") || "#ffffff";
color = rootStyles.getPropertyValue("--ls-primary-text-color") || "#000000";
}
};
rootThemeColor();
logseq.App.onThemeModeChanged(() => { rootThemeColor(); });

const baseStyles: CSS.Properties = {
position: "fixed",
zIndex: 12,
height: "calc(100vh - 8px)",
top: "8px",
background,
color,
};

logseq.setMainUIInlineStyle(baseStyles);
Expand Down

0 comments on commit 515f3f1

Please sign in to comment.