Font color selection in options menu

Hello, I'm hoping to add accessibility features to my game. One of the things recommended in the game accessibility guidelines is giving the player the ability to change the font color, to make text easier to read for people with dyslexia or glaucoma.

I've searched around and am unable to find a font color option plugin here or elsewhere and would be grateful if someone would consider creating this.
that is because color codes are already included in the default engine, and more codes are usually found in the message-sytem-type plugins.

You can either make the text color variable by including color textcode on a variable holding the color code (\C[\V[varID]]) or use a plugin that changes the window picture (which contains the color definition parts)
Here made you this. This will add a Font Color command in the Option Menu.
You can set which colors are available in the plugin parameters.
It works by setting the normalColor of Window_Base to your chosen color, so any place the normalColor would have been used this will be used instead.

If you encounter any problems or have further requests regarding this plugin feel free to message me 🙂

Code:
//=============================================================================
// Default Font Color
// MRP_DefaultFontColor.js
// By Magnus0808 || Magnus Rubin Peterson
//=============================================================================

/*:
 * @plugindesc Makes an option to set the font color
 * @author Magnus0808
 *
 * @help Just set the possible colors in the plugin parameter.
 * The first color set in the parameter will be used at the start of the game.
 *
 * @param Font Colors
 * @type struct<FontColor>[]
 * @desc The first color set will be used at the start of the game.
 * @default ["{\"Name\":\"White\",\"Color\":\"rgb(255, 255, 255)\"}"]
 */
 
 /*~struct~FontColor:
 * @param Name
 * @type String
 *
 * @param Color
 * @type String
 * @desc In the format: rgb(r, g, b), rgba(r, g, b, a), or HexCode (e.g. #FFFFFF)
 * @default rgb(r, g, b)
 */
 
 var Imported = Imported || {};
 Imported.MRP_DefaultFontColor = true;
 
 var MRP = MRP || {};
 MRP.DefaultFontColor = MRP.DefaultFontColor ||{};
 
(function() {
    MRP.DefaultFontColor.Parameters = PluginManager.parameters('MRP_DefaultFontColor');
    MRP.DefaultFontColor.fontColors = [];
    var jsonColors = JSON.parse(MRP.DefaultFontColor.Parameters['Font Colors']);
    for(var i = 0; i < jsonColors.length; i++) {
        MRP.DefaultFontColor.fontColors[i] = JSON.parse(jsonColors[i]);
        MRP.DefaultFontColor.fontColors[i].Index = i;
    }  
   
    MRP.DefaultFontColor.getNextFontColor = function() {
        var index = MRP.DefaultFontColor.currentFontColor.Index + 1;;
        if (index == MRP.DefaultFontColor.fontColors.length) index = 0;
        return MRP.DefaultFontColor.fontColors[index];
    }
   
    MRP.DefaultFontColor.getPrevFontColor = function() {
        var index = MRP.DefaultFontColor.currentFontColor.Index - 1;
        if (index == -1) index = MRP.DefaultFontColor.fontColors.length - 1;
        return MRP.DefaultFontColor.fontColors[index];
    }
   
    //-----------------------------------------------------------------------------
    // ConfigManager
    //
    // Changes to ConfigManager
   
    Object.defineProperty(ConfigManager, 'fontColor', {
        get: function() {
            return MRP.DefaultFontColor.currentFontColor;
        },
        set: function(value) {
            MRP.DefaultFontColor.currentFontColor = value;
        },
        configurable: true
    });
   
    MRP.DefaultFontColor.ConfigManager_makeData = ConfigManager.makeData;
    ConfigManager.makeData = function() {
        var config = MRP.DefaultFontColor.ConfigManager_makeData.call(this);
        config.fontColor = this.fontColor;
        return config;
    };
   
    MRP.DefaultFontColor.ConfigManager_applyData = ConfigManager.applyData;
    ConfigManager.applyData = function(config) {
        MRP.DefaultFontColor.ConfigManager_applyData.call(this, config);
        this.fontColor = this.readFont(config, 'fontColor');
    };
   
    ConfigManager.readFont = function(config, symbol) {
        if (config[symbol] !== undefined) {
            return config[symbol];
        } else {
            return MRP.DefaultFontColor.fontColors[0];
        }
    }
   
    //-----------------------------------------------------------------------------
    // Window_Options
    //
    // Changes to Window_Options
   
    MRP.DefaultFontColor.Window_Options_makeCommandList = Window_Options.prototype.makeCommandList;
    Window_Options.prototype.makeCommandList = function() {
        MRP.DefaultFontColor.Window_Options_makeCommandList.call(this);
        this.addFontColorOptions();
    };
   
   
    Window_Options.prototype.addFontColorOptions = function() {
        this.addCommand("Font Color", 'fontColor');
    };
   
    MRP.DefaultFontColor.Window_Options_processOk = Window_Options.prototype.processOk;
    Window_Options.prototype.processOk = function() {
        var index = this.index();
        var symbol = this.commandSymbol(index);
        var value = this.getConfigValue(symbol);

        if (symbol == 'fontColor') {
            let fontColor = MRP.DefaultFontColor.getNextFontColor();
            this.changeValue(symbol, fontColor);
            this.refresh();
        } else {
            MRP.DefaultFontColor.Window_Options_processOk.call(this);
        }
    };
   
    MRP.DefaultFontColor.Window_Options_cursorRight = Window_Options.prototype.cursorRight;
    Window_Options.prototype.cursorRight = function(wrap) {
        var index = this.index();
        var symbol = this.commandSymbol(index);
        var value = this.getConfigValue(symbol);
        if (symbol == 'fontColor') {
            let fontColor = MRP.DefaultFontColor.getNextFontColor();
            this.changeValue(symbol, fontColor);
            this.refresh();
        } else {
            MRP.DefaultFontColor.Window_Options_cursorRight.call(this, wrap);
        }
    };

    MRP.DefaultFontColor.Window_Options_cursorLeft = Window_Options.prototype.cursorLeft;
    Window_Options.prototype.cursorLeft = function(wrap) {
        var index = this.index();
        var symbol = this.commandSymbol(index);
        var value = this.getConfigValue(symbol);
        if (symbol == 'fontColor') {
            let fontColor = MRP.DefaultFontColor.getPrevFontColor();
            this.changeValue(symbol, fontColor);
            this.refresh();
        } else {
            MRP.DefaultFontColor.Window_Options_cursorLeft.call(this, wrap);
        }
    };
   
    MRP.DefaultFontColor.Window_Options_statusText = Window_Options.prototype.statusText;
    Window_Options.prototype.statusText = function(index) {
        var symbol = this.commandSymbol(index);
        var value = this.getConfigValue(symbol);
        if (symbol == 'fontColor') {
            return value.Name;
        } else {
            return MRP.DefaultFontColor.Window_Options_statusText.call(this, index);
        }
    };

    //-----------------------------------------------------------------------------
    // Window_Base
    //
    // Changes to Window_Base
   
    Window_Base.prototype.normalColor = function() {
        return MRP.DefaultFontColor.currentFontColor.Color;
    };
   
})();
@Magnus0808 Neat little plugin! 🙂

You may want to include aliases for ConfigManager.applyData and ConfigManager.makeData to save/load the new config value. I haven't tested, but I think as it is at the moment it will reset when you close the game. 👋
@caethyril You're ofc completely right I forgot to include aliases for ConfigManager.applyData and ConfigManager.makeData. So just as you suspected they were reset when you close the game. You even made me realize another bug or two 😅

I have fixed them now and updated my original reply.
Thanks so much! I will try this asap and see if I run into any issues.
Works perfectly! Thanks again!!

Original thread: https://forums.rpgmakerweb.com/threads/font-color-selection-in-options-menu.108174/