Metronic 8 trigger dark mode

We just downloaded Metronic 8.1.1 and are trying to set dark mode using the setMode API method mentioned in
https://preview.keenthemes.com/metronic8/demo1/documentation/getting-started/dark-mode.html

As seen below:
KTThemeMode.setMode("dark");

However I'm getting the following:
Uncaught TypeError: Cannot read properties of undefined (reading 'setAttribute')
at o (scripts.bundle.js:7:31521)
at Object.setMode (scripts.bundle.js:7:32850)
at index.html:16242:22

How can I set the mode based on the API method.
The reason I'm asking this is because we are not planning to use the built in switching method, we read user settings from the DB

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)

Hi,

This seems a bug when the theme switch menu is completely removed.
We will fix it in a future update and provide you hot fix soon.

We are releasing a new update Metronic v8.1.2 and we enabled user preference theme mode support. All you need is to set the theme mode from DB into the root HTML tag as explained here: https://preview.keenthemes.com/html/metronic/docs/getting-started/dark-mode

Please expect the new update shortly(its submitted and will be released once approved by Themeforest in a few hours) and download it from Metronic Downloads page.

Regards.

Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(