Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧩 logseq.App.onThemeModeChanged #9

Open
utterances-bot opened this issue May 31, 2023 · 1 comment
Open

🧩 logseq.App.onThemeModeChanged #9

utterances-bot opened this issue May 31, 2023 · 1 comment

Comments

@utterances-bot
Copy link

https://plugins-doc.logseq.com/logseq/App/onThemeModeChanged

Copy link

YU000jp commented May 31, 2023

Get theme color from DOM

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

  //Credit: YU000jp

https://github.com/YU000jp/logseq-plugin-weekdays-and-weekends/blob/34e65b3a0f53062938e513110c15641a39a8112d/src/index.ts#L17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants