MV Help to trigger some keyboard buttons with YEP_ButtonCommonEvents.js

Hey, im a little confused... when using this plugin, it allows you to assign a common event to a pressed key, but I want to know if it is possible to activate and deactivate something by pressing the same button as if it were a switch.

Example in pseudocode:

Press "T":
The screen turns gray color.
(Using a common event)

Press "T" again:
The screen returns to normal color.

This is where my question is, ¿how can I make pressing the same key again take me to normal color?
You should put your branching logic inside your common event. Something like:

Code:
if switch ON then
    switch OFF
    turn off lights
else
    switch ON
    turn on lights
end

Original thread: https://forums.rpgmakerweb.com/threads/help-to-trigger-some-keyboard-buttons-with-yep_buttoncommonevents-js.128374/