Window Color changes as game progresses

My project has, at the end of every chapter, a part where the player is faced with a moral dilemma and is forced to make a decision that will radically alter the world they had journeyed through in that chapter. These moral dilemmas always have three options and are always color-coded with red, green and blue respectively. I want it so that every time a player goes with an option, the window colors become brighter in the color the player picked.

For example, the Window Color at the start of the game is at [-255, 0, -255](aka a sort of dark green) if the player picks mostly red options, I want the menu color to become [0, -255, -255](aka dark red).

Is there a way to do this through common eventing or am I gonna need a plugin?
You need a script for this, and 3 variables.
Code:
class Window_Base < Window
  def update_tone
    self.tone.set(Tone.new($game_variables[X],$game_variables[Y],$game_variables[Z]))
  end
end

Put this code into a new entry in your script editor, then change X, Y, and Z to the variables you want to use. You don't need any script calls or Common Events; changing any of the variables will apply the change immediatly.
@Shiro-chan that completely overwrites the old method though, which means that the window will not have the tone set in the system settings when the game starts.

Code:
class Window_Base < Window
  #----------------------------------------------------------------------------
  # * Aliased Method: Update Tone
  #----------------------------------------------------------------------------
  alias hrk_update_tone_old update_tone
  def update_tone
    if $game_switches[X]
      self.tone.set(Tone.new(*$game_variables[Y]))
    else
      hrk_update_tone_old
    end
  end # Update Tone
end # end of Window_Base class

If you use this you can store the three values you need in variable Y like this:
Code:
[r, g, b] # r is red, g is green, b is blue

There is no need for a script call as you can do it using the Script box in the Control Variable event command. This will still use the old method when the switch X is not active, which allows you to keep using the original settings before the end of the game. It goes without saying that yo have to change X and Y in my script accordingly.

@FirestormNeos just a random off-topic tip: don't refer to scripts as plugins, that is the word used to refer to MV plugins. VX Ace scripts are usually referred as "scripts".
@Heirukichi isn't the correct syntax, like this?
Code:
self.tone.set(Tone.new(*$game_variables[Y]))
@TheoAllen yes it is, I will promptly fix those (both the missing * and the missing parenthesis).

EDIT: on a side note the syntax
Code:
self.tone.set(*$game_variables[Y])
should also be correct as the set method of the Tone class can receive either a tone or a set of colors (that is if I am not wrong).

Original thread: https://forums.rpgmakerweb.com/threads/window-color-changes-as-game-progresses.114587/