# How do I find all onAppEvents? Is there any event for color scheme switching?

**URL:** https://meta.discourse.org/t/how-do-i-find-all-onappevents-is-there-any-event-for-color-scheme-switching/191509
**Category:** Development
**Created:** [May 24, 2021, 8:44pm UTC](https://meta.discourse.org/t/how-do-i-find-all-onappevents-is-there-any-event-for-color-scheme-switching/191509 "2021-05-24T20:44:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Alex\_P](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_p/32/163548_2.png) [@Alex\_P](https://meta.discourse.org/u/Alex_P)
#### Post date: [May 24, 2021, 8:44pm UTC](https://meta.discourse.org/t/how-do-i-find-all-onappevents-is-there-any-event-for-color-scheme-switching/191509/1 "2021-05-24T20:44:38Z")

</div>

In the JS API there is [onAppEvent](https://github.com/discourse/discourse/blob/ca809d2c40a75fa93b6a9a4d4dbc3b330b1aea13/app/assets/javascripts/discourse/app/lib/plugin-api.js#L519) allowing to listen for an event. But how can I find the list of these events? I tried searching for `onAppEvent` and `.trigger(`, but have not found much.

Right now I am looking for an event triggering on the automatic color scheme switching ([Automatic Dark Mode color scheme switching](https://meta.discourse.org/t/automatic-dark-mode-color-scheme-switching/161593)). Does such event exist?

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [May 25, 2021, 8:18am UTC](https://meta.discourse.org/t/how-do-i-find-all-onappevents-is-there-any-event-for-color-scheme-switching/191509/2 "2021-05-25T08:18:11Z")

</div>

You need to look for `this.appEvents.trigger` and `this.appEvents.on`  
This object accessible from a handful of ember objects.

> <https://github.com/discourse/discourse/blob/50926f614342336793f1b78672b387d545d48de3/app/assets/javascripts/discourse/app/pre-initializers/inject-discourse-objects.js#L45>

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [May 25, 2021, 2:29pm UTC](https://meta.discourse.org/t/how-do-i-find-all-onappevents-is-there-any-event-for-color-scheme-switching/191509/3 "2021-05-25T14:29:49Z")

</div>

> [@Alex\_P](#):
>
> the automatic color scheme switching

This specific event is handled by the browser, Discourse doesn’t have its own event here. But you can have a JS listener for the `prefers-color-scheme` media query. See [Redirecting to: /lesson/css-tips/dark-mode/](https://flaviocopes.com/javascript-detect-dark-mode/) (or search Google for other examples).
