Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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:
<script> KTThemeMode.setMode("dark"); </script>

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(