MV How do I change the entire screen to greyscale using javascript?

Basically, if anyone can point me in the right direction to do something like this or even IF we can do something like this. Any help is appreciated.
You can find pixi filter plugins that can do this but a simpler way without plugins would be to simply run this from script call:
document.getElementsByTagName('body')[0].style.filter='grayscale(100%)';
To remove it, run:
document.getElementsByTagName('body')[0].style.filter='none';
Quick notes:
  1. If using @Hyouryuu-Na's solution, I think that:
    • The filter will persist when exiting to the title screen and choosing new/load game.
    • The filter will reset when the game is closed.

  2. If you only want to apply greyscale to the map/battle but not menus and other game windows, you can use the Tint Screen event command. 🙂
Oh yeah I didn't think about that ^^; @caethyril Yes, the state won't be saved.
Quick notes:
  1. If using @Hyouryuu-Na's solution, I think that:
    • The filter will persist when exiting to the title screen and choosing new/load game.
    • The filter will reset when the game is closed.

  2. If you only want to apply greyscale to the map/battle but not menus and other game windows, you can use the Tint Screen event command. 🙂

No I know how to use that, I need an alternative method, particularly a point in the right direction to code this. Thanks for the help though.
You can find pixi filter plugins that can do this but a simpler way without plugins would be to simply run this from script call:
document.getElementsByTagName('body')[0].style.filter='grayscale(100%)';
To remove it, run:
document.getElementsByTagName('body')[0].style.filter='none';

Thank you very much for this solution, I will try and mess around with this and get back to this thread right away. 🙂

*Note I clicked edit and it double posted my stuffs, currently using safari on a MacBook Pro.

Edit* This works!! thank you so much for this, I only need for cutscene so I will remove anyway after cutscene so I think it will work exactly for what I need it for, the event command is broken due to plugins, so if this has happened to others because of for example lighting plugins, then this would effect the event command working.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-change-the-entire-screen-to-greyscale-using-javascript.128493/