Plugin personalization - CSS style

Hi everyone,
first of all I hope I am posting in the correct place.
I want to edit style in the @biud436 wonderful MZ Input Dialog plugin.
In plugin's properties there is a "CSS" option that only says "Edit CSS as you want".
I just want to change text size, alignment, and few little things, but did not have no CSS experience, so I took a couple of days to study it and came out whit this code:
CSS:
<style>
{
  text-align: center;
  text-transform: uppercase;
  font-size: 40px;
  font-family: "Lucida Console", "Courier New", monospace;
}
</style>
But just copying that code (and some other versions I tried) in that "CSS" option space just nothing happens.
What am I doing wrong?
Can somebody help me?
Thanks with anticipation, and have a good day.
Have you tried just the CSS properties without the style tag?
It looks like that portion of the code is already placed inside style tags. So you wouldn't write them again, you'd just list the properties you want to change.

You also wouldn't put braces there.
.inputDialog seems to be the CSS class selector for the plugin's <input> element, so I'd suggest:
CSS:
.inputDialog {
  text-align: center;
  text-transform: uppercase;
  font-size: 40px;
}
(font-family should already be handled by the Font Family plugin parameter?)

If you want to style the buttons as well, you could try adding another { block }, e.g.
CSS:
.defaultButton {
  /* your stuff here */
}
.inputDialog seems to be the CSS class selector for the plugin's <input> element, so I'd suggest:
CSS:
.inputDialog {
  text-align: center;
  text-transform: uppercase;
  font-size: 40px;
}
(font-family should already be handled by the Font Family plugin parameter?)

If you want to style the buttons as well, you could try adding another { block }, e.g.
CSS:
.defaultButton {
  /* your stuff here */
}
Hi!
Everything is working, except the "font-size" command/line: I tried changing the value (also using different specifications, such as "medium" or "large" instead of a number), but the font size does not change.
Any idea?
Oh, it looks like the plugin explicitly overrides the font size on lines 327~329:
JavaScript:
textBox.style.fontSize = Utils.isMobileDevice()
    ? "1rem"
    : 2 * Graphics._realScale + "em";
I think that's to ensure it scales with the rest of the game. Maybe try replacing the 2 with a different value, e.g. 2.5?
Oh, it looks like the plugin explicitly overrides the font size on lines 327~329:
JavaScript:
textBox.style.fontSize = Utils.isMobileDevice()
    ? "1rem"
    : 2 * Graphics._realScale + "em";
I think that's to ensure it scales with the rest of the game. Maybe try replacing the 2 with a different value, e.g. 2.5?
No, it doesn't work.
Maybe because those lines refer to mobile device, while I am testing it (an the game will play only) on a PC?
If you don't mind using a different plugin, there is one that's very similar to
@biud436 wonderful MZ Input Dialog plugin
It's 111_InputForm.js (credit to 111, and Kuramubon) which allows you to use your own css file inside your game's css folder. Then, all you have to do is edit that css file and not have to play around with the actual js file. I use my own edited version of that plugin (edits include disabling autocomplete, using a number type if desired, and allowing for different css files to be used rather than just the same one all the time). If you're interested in checking it out, this is my modified version (must be saved as 111.InputForm2.js).

Spoiler: 111.InputForm2.js
JavaScript:
//=============================================================================
// InputForm.js
// PUBLIC DOMAIN
// ----------------------------------------------------------------------------
// 2017/09/03 Fixed a bug that prevented you from pressing the "Confirm" button on iOS & disabled clicking on the back game screen
// 2018/12/06 Input field size is adjusted to fit screen size & Fixed bug of screen misalignment on iPhone & Font size setting & Default value setting
// 2020/08/22 Compatible with RPG Maker MZ
// Raw js code found at https://raw.githubusercontent.com/krmbn0576/rpgmakermv/master/js/plugins/111_InputForm.js
// Raw css code found at
https://raw.githubusercontent.com/krmbn0576/rpgmakermv/master/css/111_InputForm.css
// 2024/05/21 Added an argument to assign 'type number' to inputform & added a second argument to assign a specific css file (111_InputForm.css remains the default)
//=============================================================================

/*:
 * @target MZ
 * @plugindesc Create a form and enter text (revised and modified version)
 * @author 111, Kuramubon, Lady JJ
 *
 *
 * @help
 * Display the character input form and let the user enter characters.
 * Unlike the event command "Name input processing",
 * You can use familiar keyboard input and flick input.
 * You can also enter any characters you want, including kanji.
 *
 * ---Preparation---
 * Put 111_InputForm.css in the css folder in the game folder (create it if you don't have it).
 * By the way, you can change the design, width, etc. of the input form by modifying this file.
 *If you don't know how to do it, just search for "how to write css" or something similar!
 *
 * ---How to use with RPG Maker MZ---
 * You can display the input field using the plugin command.
 * At a minimum, adjust the display position with "X position of input field" and "Y position of input field".
 * It works if you set a variable in "Substitution destination of input result".
 * Please adjust other parameters if necessary.
 *
 * ---How to use in RPG Maker MV---
 * ◆Plugin command: InputForm x=350;y=200;v=11;max=5;
 * Something like that. In this example, it will be displayed at x350,y200 and the result will be saved in variable number 11.
 * The maximum number of characters is 5 (you can omit max to make it unlimited).
 *
 * If you want to create a timeout, add if_s=3;
 * You can force quit “if switch 3 is turned on”
 * Let's create an event to turn on switch 3 in the parallel events
 * (Hammering point 1) In this case, at the moment of forced termination,
 * Note that the text is stored securely in the result variable.
 *
 * The next event command will not be read until input is complete
 * (Stuck point 2) Until the next event command is loaded
 * Be careful not to overwrite the resulting variable with other parallel processing as there is a short delay.
 *
 *
 * Function addition:
 * Inputform (omitted) btn_x=100;btn_y=100;
 * The position of the "Confirm" button can be finely adjusted by writing it as *.
 * Value is relative to the text box, default is btn_x=0;btn_y=50;
 *
 * (Added 2018/12/06)
 * The scale of the input field and OK button now expands and contracts to match the screen scale.
 *
 * Inputform (omitted) font_size=30;
 * You can change the font size of the input field and decision button.
 * If font_size is not specified, font_size=24.
 *
 * Inputform (omitted) placeholder=text;
 * You can display the contents of the "text" in the input field from the beginning.
 * Please use this when setting a default name.
 * If you specify placeholder=$;, the contents of variable v will be displayed.
 *
 *License:
 * There are no restrictions on how you use this plugin. Feel free to use it however you like.
 *
 * @command show
 * @text Processing character input
 * @desc
 *
 * @arg target_x
 * @type number
 * @text X position of the input field
 *
 * @arg target_y
 * @type number
 * @text Y position of the input field
 *
 * @arg variables_id
 * @type variable
 * @text Variable ID to store input result
 *
 * @arg max_count
 * @type number
 * @text Maximum number of characters
 *
 * @arg if_switch_id
 * @type switch
 * @text ON Forcibly terminate input at
 *
 * @arg button_x
 * @type number
 * @min -10000
 * @default 0
 * @text Relative X position of the enter button
 *
 * @arg button_y
 * @type number
 * @min -10000
 * @default 50
 * @text Relative Y position of the enter button
 *
 * @arg unit_font_size
 * @type number
 * @default 24
 * @text Font size
 *
 * @arg placeholder
 * @type string
 * @text Initial value of input field
 *
 *@arg attr_wintype
 *@type number
 *@default 0
 *@text Type of Window (0 = text, 1 = number)
 *
 *@arg css_file
 *@type string
 *@default 111_InputForm
 *@text Name of css file to use (default is 111_InputForm)
*/
(function() {
    function stopPropagation(event) {
        event.stopPropagation();
    }

    //Add css function moved to Game_Interpreter.prototype._inputForm

    // To disable key input
    Input.form_mode = false;
    var _Input_onKeyDown = Input._onKeyDown;
    Input._onKeyDown = function(event) {
        if(Input.form_mode)return;
        _Input_onKeyDown.call(this , event)
    };
    var _Input_onKeyUp = Input._onKeyUp;
    Input._onKeyUp = function(event) {
        if(Input.form_mode)return;
        _Input_onKeyUp.call(this , event)
    };
    // Do not load the next event command until the input is complete
    var _Game_Interpreter_updateWaitMode =
            Game_Interpreter.prototype.updateWaitMode;
    Game_Interpreter.prototype.updateWaitMode = function(){
        if(this._waitMode == 'input_form')return true;
        return _Game_Interpreter_updateWaitMode.call(this);
    }

    HTMLElement.prototype.postionAdjust = function(screen_postion , target_postion, unitFontSize){
        this.style.left = screen_postion[0] + target_postion[0] * Graphics._realScale + "px";
        this.style.top  = screen_postion[1] + target_postion[1] * Graphics._realScale + "px";
        this.style.fontSize = unitFontSize * Graphics._realScale + "px";
        this.style.maxWidth = 'calc(100% - ' + this.style.left + ')';
        this.style.maxHeight = 'calc(100% - ' + this.style.top + ')';
    };
    // Enable arguments like x=350;y=200;
    var argHash = function(text , arg_names){
        var _args = new Array(arg_names.length);
        var ary = text.split(";");
        ary.forEach(function(str){
            var s_ary = str.split("=");
            var prop = s_ary[0].toLowerCase();
            var value = s_ary[1];
            _args[arg_names.indexOf(prop)] = value;
        });
        return _args;
    }
    //=============================================================================
    // Game_Interpreter - register plugin commands
    //=============================================================================
    var _Game_Interpreter_pluginCommand =
            Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);
        if (command === 'InputForm'){
            var _ary = argHash(args[0] , ["x" , "y" , "v" , "max" , "if_s", "btn_x", "btn_y", "font_size", "placeholder","attr_wintype", "css_file"]);
            var target_x = +_ary[0];
            var target_y = +_year[1];
            var variables_id = +_ary[2];
            var max_count = _ary[3] || null;
            var if_switch_id = Number(_ary[4]) || null;
            var button_x = +_ary[5] || 0;
            var button_y = _ary[6] === '' || isNaN(_and[6]) ? 50 : +_and[6];
            var unit_font_size = _ary[7] === '' || isNaN(_and[7]) ? 24 : +_and[7];
            var placeholder = _ary[8];
            var attr_wintype = ary[9];
            var css_file = ary[10];
            this._inputForm(target_x, target_y, variables_id, max_count, if_switch_id, button_x, button_y, unit_font_size, placeholder, attr_wintype, css_file);
        }
    };

    if (PluginManager.registerCommand) {
        PluginManager.registerCommand("111_InputForm2", "show", function(args) {
            var { target_x, target_y, variables_id, max_count, if_switch_id, button_x, button_y, unit_font_size, placeholder, attr_wintype, css_file } = args;
            this._inputForm(+target_x, +target_y, +variables_id, +max_count, +if_switch_id, +button_x, +button_y, +unit_font_size, placeholder, attr_wintype, css_file);
        });
    }

    Game_Interpreter.prototype._inputForm = function(target_x, target_y, variables_id, max_count, if_switch_id, button_x, button_y, unit_font_size, placeholder, attr_wintype, css_file) {
            var interpreter = this;
            var gui = {
                input : null ,
                submit : null ,
                is_pc : true ,
                init : function(){
                    this.is_pc = Utils.isNwjs();
                    this.create();
                    this.input.focus();
                    this.screenAdjust();
                } ,
                create : function(){
                    // input form
                    this.input = document.createElement('input');
                    this.input.setAttribute('id', '_111_input');
                    // Autocomplete (Default = 'on', set of 'off' if desired)
                    this.input.autocomplete = 'off';// change to 'on' if desired
                    // Type of window (0 = text, 1 = number)
                    if (attr_wintype == 1) {this.input.setAttribute('type','number')};
                    if(max_count)this.input.setAttribute('maxlength', max_count);

                    if (placeholder === '$') {
                        placeholder = $gameVariables.value(variables_id);
                    }
                    this.input.setAttribute('value', placeholder || '');
                    document.body.appendChild(this.input);

                   // Link css file
                    var cssFile = css_file;
                    var css = document.createElement('link');
                    css.rel = "stylesheet";
                    css.type = 'text/css';
                    css.href = './css/'+css_file+'.css';
                    var b_top = document.getElementsByTagName('head')[0];
                    b_top.appendChild(css);

                    // send button
                    this.submit = document.createElement('input');
                    this.submit.setAttribute('type', 'submit');
                    this.submit.setAttribute('id', '_111_submit');
                    this.submit.setAttribute('value', 'Submit');
                    document.body.appendChild(this.submit);
                } ,
                success : function(){
                    $gameVariables.setValue(variables_id , this.input.value);
                    this.end();
                } ,
                cancel : function(){
                    $gameVariables.setValue(variables_id , this.input.value);
                    this.end();
                } ,
                start : function(){
                    interpreter.setWaitMode('input_form');
                    Input.clear();
                    Input.form_mode = true;
                    // SceneManager._scene.stop();
                } ,
                end : function(){
                    this.input.remove(); // document.body.removeChild(this.input);
                    this.submit.remove();
                    window.removeEventListener("resize", resizeEvent, false);
                    interpreter.setWaitMode('');
                    Input.form_mode = false;
                    clearInterval(_event);
                    // SceneManager._scene.start();
                } ,
                screenAdjust : function(){ // Adjust to the position based on the top left of the canvas
                    var screen_x , screen_y;
                    var _canvas = document.getElementById('UpperCanvas') || document.getElementById('gameCanvas');
                    var rect = _canvas.getBoundingClientRect();
                    screen_x = rect.left;
                    screen_y = rect.top;
                    this.input.postionAdjust([screen_x,screen_y] , [target_x,target_y], unit_font_size);
                    this.submit.postionAdjust([screen_x,screen_y] , [target_x + button_x,target_y + button_y], unit_font_size);
                }
            }
            //
            gui.init();
            // Event to send gui.input.onkeydown = function(e){
            gui.input.addEventListener("keydown" ,function(e){
                if(e.keyCode === 13){ // Send with decision key
                    Input.clear();
                    gui.success();
                    // Stop event propagation to parent (so that keydown of document does not react)
                    e.stopPropagation();
                }
            });
            gui.input.addEventListener("mousedown", stopPropagation); // Prevent clicks on the back game screen
            gui.input.addEventListener("touchstart", stopPropagation); // Measures for not being able to receive click events on iOS
            gui.submit.addEventListener("mousedown", stopPropagation); // Prevent clicks on the back game screen
            gui.submit.addEventListener("touchstart", stopPropagation); // Measures for not being able to receive click events on iOS
            gui.submit.addEventListener("click" ,function(){ // Submit button click
                gui.success();
                return false;
            });
            // event to cancel
            if (if_switch_id) {
                var _event = setInterval(function(){
                    if($gameSwitches.value(if_switch_id)){
                        // clearInterval(_event);
                        gui.cancel();
                    }
                }, 1);
            }

            // On the web, there is an event that recalculates the % every time the window size changes.
            //if(! gui.is_pc){
                var resizeEvent = gui.screenAdjust.bind(gui);
                window.addEventListener("resize", resizeEvent, false);
            //}
            //
            gui.start();
    };
})();

and a sample 111_InputForm.css
Spoiler: 111.InputForm.css
Code:
 #_111_input{
    position: absolute; /* */
    z-index: 999; /* */
    text-align: left;
    /*font-size: is set in the plugin parameters */
    width: 5em; /* 5em;  ← This number represents the width of the window */
    height: 1.875em;  /*2em; ← This number represents the height of the window */

    font-weight: bold;
    color: #cf9d16;
    background-color: transparent;

    font-family: tabitha; /*GameFont;*/

    border: none;
    border-style: none;
    border-color: none;
    border-radius: none;
    padding-left: 0.5em;
}
/* From here, it is the setting related to the design of the enter button。 */
/*
#_111_submit{
    position: absolute;
    z-index: 999;
    text-align: center;
    font-size: 40px;
    width: 60;
    height: 58px;

    font-weight:bold;
    color: #cf9d16;

    border:solid 0.125em #e5ff00;
    border-radius: 0.2em;
    padding: 0.04em 0.5em;
    background: rgba(0,0,0, 0.75);
} */
No, it doesn't work.
Oh.
Maybe because those lines refer to mobile device, while I am testing it (an the game will play only) on a PC?
You have interpreted the code incorrectly. Those 3 lines can be read as:
  1. Is this running on mobile?
  2. If yes, use "1rem" (i.e. the root element font size).
  3. If no, use 2 * Graphics._realScale + "em" (i.e. double the parent's font size at 100% scale).
That's why I suggested to try replacing the 2. But if that doesn't work then I'm not sure.

Lady_JJ's suggestion looks good, though!
If you don't mind using a different plugin, there is one that's very similar to

It's 111_InputForm.js (credit to 111, and Kuramubon)

Sounds super interesting, and many thaks for translating it, however I can't make it work.
Surely it is because, as I already said, unfortunately I don't know how to code the .css file.
I put in it these lines:

CSS:
<html>

.inputDialog {
    font-size: 50px;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
}

</html>

And in the image you can see how I set up the plugin.
111InputSettings.png

What am I doing wrong?
Your CSS file syntax is incorrect. <html> is for HTML files, not CSS files, and this plugin uses a different name for its input element.

Start with the provided template, then edit/add your lines as needed:
  1. font-size: 50; - no edit required, set it with the Font Size plugin parameter instead.
  2. font-weight: bold; - no edit required, because this is already in the template.
  3. text-align: center; - the template has text-align: left;, just edit that.
  4. text-transform: uppercase; - add this as a new line, e.g. after font-family.
Then save the result as 111_InputForm.css in your project's css subfolder.

If that works out, you could also edit the font-family line to match your original monospace settings. 👋


Alternatively, with the Input Dialog plugin you were originally using, you could try one more edit. Replace this line:
JavaScript:
    : 2 * Graphics._realScale + "em";
...with this:
JavaScript:
    : Math.floor(50 * Graphics._realScale) + "px";
I.e. "50 px at 100% game scale". 50 is pretty big, so you may want to replace that value.

(Math.floor just ensures that the result will be an integer. I'm not sure if that's necessary, but I feel like pixels should always be whole numbers. 😴)
Start with the provided template
OMG, I feel so stupid, I didn't even realised there was a .css template file!!
Sorry for that, in any case thanks for the help in configuring it, it is really appreciated, will try it asap.
For now I just tried your other option, the dit in @biud436's plugin, but sadly it does not work.
No worries! I must be missing something with biud's plugin. Good luck~

Original thread: https://forums.rpgmakerweb.com/threads/plugin-personalization-css-style.168695/