The New Way to Build with AI! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Browse ReUI Pro

KTThemeMode click behavior

Hello,

Can I suggest a small change in the KTThemeMode logic?

I'm using the event kt.thememode.change to grab user's choice and save it in the database.

But there is a scenario where this event is not triggered:

Imagine that:

  • My system theme is 'dark'
  • My current selection is theme 'dark'
  • I'll try to change to 'System' (so I can control it through my system)
  • There is no event trigger
<code> if (mode !== currentMode) { KTEventHandler.trigger(document.documentElement, 'kt.thememode.change', the); } </code>

It should be nice to trigger this event when I'm changing values. Even from 'dark' to 'system' (assuming my system is dark) Or from 'light' to 'system' (assuming my system is light)

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)

 
Deleted comment
 
Deleted comment
 
Deleted comment
 
Deleted comment

Hi,

Sorry for the late reply

In src/js/layout/theme-mode.js in the end of setMode function can you try to change:


if (mode !== currentMode) {
KTEventHandler.trigger(document.documentElement, "kt.thememode.change", the);
}


to:


KTEventHandler.trigger(document.documentElement, "kt.thememode.change", the);



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  :(
buy metronic keenthemes mega bundle

ReUI

Open-source React components, blocks and templates built on shadcn/ui and Tailwind CSS by Keenthemes.