TSR_TextColorAddOn by The Northern Frog


TSR_ColorSc1.png

download:
TSR_TextColorAddOn v1.6.4
Author: TSR, The Northern Frog
​
RPG Maker MV let you change the font color in text windows using the escape code '\C[x]' where x range from 0 to 31, providing colors from the default window skins of /img/system/Window.png.​

This simple Plugin now allow you to add more text color codes, starting from 32. It also give the option of adding a second color to generate a color gradient effect on the text. You can also change the Outline color and Width of the text, all of this using the commonly used '\C' escape code.​

In addition, the Plugin allow the use of '\C[x]' basically anywhere text can be input.​


Spoiler: Screenshots
TSR_ColorSc2.png
Capture d’écran 2020-04-06 à 16.27.08.png

Capture d’écran 2020-04-29 à 18.37.27.png
Capture d’écran 2020-05-02 à 12.08.34.png

Capture d’écran 2020-05-02 à 12.09.14.png

Text Color Object Properties:​
========================================================================​
There is only one parameter called Text Color Object. It is a notebox where you can create your colors properties.​
​
Properties consist of pairs of code:color, and each properties must be separated by comas. The codes are starting from 32 and can be any number you want. The color are defined using CSS. You can use either a predefined CSS color name or make your own using Hex value or rgba values to define the color.​

* Exemple: 'Aqua' or '#00ffff' will render the same color

Fill the Text Color Object notebox to your liking, adding colors associated with code above 31 and separate each with comas.​

*Exemple: 32: Aqua, 33: DarkCyan, 34: DarkKhaki

Then, use the associated code with '\C[x]', when allowed, to change the font color to the corresponding color. Like, according to what's above, \C[32] will render Aqua colored text.

To use rgba(r, g, b, a) format in the Text Color Object, enter your rgba values inside the brackets without comas and with a single white space, like this:

*Exemple: rgba(0 0 0 0.5)

Hence, writing:

32: Aqua or 32: #00ffff or 32: rgba(0 255 255 1) will render the same color.


Text Color Gradient:
========================================================================
Thanks to Shadowdragon, the Plugin now integrate the color gradient functions of ShadowDragon_TF.js allowing to render color gradient effect on text.


To add a color gradient effect on a text, enter 2 colors in the brackets, like this:

Exemple: C\[5, 27] *white spaces after the coma doesn't matters


Text Outline Color and Width:
========================================================================
To change the Outline color of the text, add a color code preceded by the letter 'o':

Exemple: \C[12, o18] render text color 12 with outline color 18


You can combine gradient and outline color like: \C[5, 27, o30]

* Note that the outline color should always be the last parameter.


Default outline width is 4 pixels, but sometime, you may want to adjust it depending of the font size you're using and the color effect you want. You can change the outline width by adding 'w' follow by the width in pixels you want.

Exemple: \C[5, 27, o30w3] gradient 5 to 27, outline color 30 and width 3 pixels


*Note that there's no coma between outline color and width. A white space can be accepted, but no coma!


Using text code in database:
======================================================================
By adding text color codes to database entries such as Items, Weapons and armors names, you can change their color when displayed. Color codes can also be use anywhere like Map Name entry or Game Title.​


The same can be done with the Icon Escape Code \I[x] to easily display colors and icons in command menus if desired.​

Exemple: writing '\I[60]\C[11]' in the 'Item' entry of the 'Terms' section of the database, will display icon 60 and color the text in both Battle Command window and Main Menu Command window.​

Other codes that works are \V[x] to show variables value, \N[x] to display actor names and \G to show currency unit. Of course, result may vary when showing long string.​


Try it for yourself and use it with parsimony, because showing too much colors is the same as not enough...​


ToU:
========================================================================
Free to use in any RPG Maker MV projects, including commercials.

Credit is required for using this Plugin.

Credit to 'TSR' followed by either 'The Northern Frog' or 'A frog from the north'

Do not change the Header or the Terms of usage.

Editing of the script is permited but credit would still be required.


DO NOT REDISTRIBUTE! If you want to share it, share the link to my itchi.io account:
https://the-northern-frog.itch.io/

If you edited the plugin and would like to distribute it, contact me.

This plugin was made for free use among the RMMV game dev community. Hence, it is free and will remain free.
Absolutely insane I JUST Now needed this and here you come along! not even a full week out and this plugin has saved someone who has had an issue with text color AND outlines for Alll day. Me and my migraine thank you!
Hello all!
New update TSR_TextColorAddOn version 1.7.6

The Plugin now give the option to import a custom sprite sheet in /img/pictures and use it to display some additional custom icons with text code '\i[x]'.

Capture d’écran 2020-05-17 à 14.46.32.png

Code:
 * Custom Icons Sheet:
 * ===========================================================
 * Import a sprite sheet in /img/pictures, specify its dimensions
 * through a few Plugin parameters, and show your new icons in text
 * boxes using escape code '\i[x]' where x is determined by the
 * starting index Plugin parameter.
 *
 * Plugin parameters:
 *
 *     Icons Sheet Name
 *         The file name of the sprite sheet in /img/pictures without
 *         file extension.
 *
 *     Sheet Starting Index
 *         This is the starting icon code for your icon sprite sheet.
 *         Default Plugin value is 500. If you leave it that way, the
 *         icon codes for your custom sprite sheet will start at 500.
 *         That mean writing \I[500] will show the first index of your
 *         sprite sheet, that is the upper left corner frame (index 0).
 *   
 *         If you set the starting index to 0, it will overide all the
 *         default icons, so unless that's what you want, I recommand
 *         leaving it to 500, or any number that won't overlap with your
 *         main icon set in /img/system.
 *
 *     Sheet Frame Size
 *         This is the size of one frame in your sprite sheet. The default
 *         icon set is 32x32 pixels icons, but you can use any size you
 *         want. Enter the number in pixels of the size of one frame in your
 *         custom sheet.
 *
 *     Sheet SpritePerRows
 *         This is to tell the Plugin how many frame (images) are in one
 *         row of the custom sheet. As an exemple, the default icon sheet
 *         have 16 frames (icons) by rows.
 *
 *     Icons Auto Scale
 *         In most cases, when using the icon code '\i[x]' with this Plugin,
 *         icons will auto scale themselves according to the font size, so
 *         they always look in place and aligned with text. If for any reason,
 *         you need your custom icons to appear in their actual dimension, turn
 *         that parameter OFF.
 *
 *
 *     Exemple
 *         We'll use a Battler Sprite sheet as exemple:
 *
 *              Icons Sheet Name:      Actor1_1       
 *              Sheet Starting Index:  500 (default)
 *              Sheet Frame Size:      64             
 *              Sheet SpritePerRows:   9
 *              Icons Auto Scale:      true
 *
 *        Now using code \i[500] in a text string will make Harold appear as
 *        an icon scaled to the text. Since Battlers sheet are 9 columns by
 *        6 rows, we can use icon codes from 500 to 553 for the whole sheet.
 *        Using \i[552] for instance will show a very dead Harold icon.
 *        Turning the Auto scale to false would make Harold icons appear
 *        as 64x64 pixels images that would most likely clash with the text...
 *
 *

DOWNLOAD:
TSR_TextColorAddOn​
New update!

This version add 2 new text adjusting parameters for more convenience:

  • Auto Outline Opacity
    Outline Colors looks better when they are shown with half opacity. This parameter allow to set the outline colors opacity to 50% automatically when you set outline colors using text color codes.​
  • Text Adjusting Font Size When this parameter is On, if the text length (after removing all text codes) is over the maximum width allowed for the window/box/menu, the fontSize will be reduced slightly so it fits the available space.​
DOWNLOAD:
TSR_TextColorAddOn​
Hi TSR, this plugin is the best text color plugin I have found. But it may conflict with yanfly's job Points plugin?
When I use them at the same time, there will be a strange line in my main menu window and equipment window. It is useless if I change the position of the plug-in. My UI skin has been tested
Although this is not a big problem, wouldn't it be great if it could be perfect?

UI.png

This is the list of new project plugins I used for testing。
QQ截图20200816054708.png
Hello! Thanks for reporting that. 👍
Give me some time so I can install YEP_JobPoints and see if I can reproduce that bug and find what causing it. Thank you!
Hello! Thanks for reporting that. 👍
Give me some time so I can install YEP_JobPoints and see if I can reproduce that bug and find what causing it. Thank you!
Okay, this plugin is really great. It freed me from several text color plugins. It can be used in almost any text.
And there is no conflict with dozens of other plugins of mine! But I don't understand why it conflicts with JP, it seems that they are not the same type of plug-in. . .
Hope more people can find this plugin and support you!
@41728280 you can try to put TSR plugins below yanfly engine core and not below it.
it will get all drawtext stuff from the plugins below 🙂

if the problem persist, it might be a conflict, but your sr is on the bottom, so move it
below yanfly engine core and see if that works for you.
@41728280 you can try to put TSR plugins below yanfly engine core and not below it.
it will get all drawtext stuff from the plugins below 🙂

if the problem persist, it might be a conflict, but your sr is on the bottom, so move it
below yanfly engine core and see if that works for you.
Thank you, I have tried any sorting. Whether the TSR plug-in is placed at the top or the bottom, as long as these three plug-ins are turned on at the same time, this error will appear.
Unless you put the JP plug-in above the yanfly core or turn off the yanfly core, but the yanfly core is indispensable to me.
And if I change the order of JP plug-ins, after a simple test, JP will not be displayed in the menu, and I don’t know if there will be more serious errors.
This is just my project for testing plug-ins. My normal project uses dozens of plug-ins. I don’t know if changing the order of JP plug-ins will affect all other yanfly plug-ins. You know that the ordering of yanfly plug-ins is very strict. . . When I eliminated errors in my normal project, I found that it was only the relationship between these three plug-ins. This is enough to prove that the compatibility of the TSR plug-in is very good. If the plug-in creator finds out and resolves where the three plug-ins conflict, I think it would be better!
I have all plugins of YEP before paid wall though, but if JobPoits use drawtext, the error
might come, which I had with MOG_TreasurePopups, he made it so, every drawText
and drawTextEx is taken from the other plugin to show color if used.

if for some reason (yep_coreEngine, TSR_TextColorAddon, YEP_JobPoints) doesn't work,
than job points might have a different mechanic for the drawText.

If that is the case, He will be able to fix it and update it.
this mostly takes a couple of hours to a few days, if he isn't busy with anything else.

He also make sure there is no conflict to most of YEP library plugins except 1.
SaveCore and TSR_Save, so there might be a tiny conflt with a drawTextEx.

Be patient though and he get it done for you 🙂
Hello! I've found the issue.
I've installed YEP_jobPoints and TSR_TextColorAddOn in a test project, and a strange line did appeared at the bottom of the main menu status window, and in the skill scene (in other words, where job points are displayed).
Capture d’écran 2020-08-16 à 13.35.02.png

When I added YEP_coreEngine, it became even weirder...
Capture d’écran 2020-08-16 à 13.35.34.png

Turning OFF TSR_TextColorAddOn removed the line.
Capture d’écran 2020-08-16 à 13.36.08.png

Yanfly use this function in YEP_jobPoints and coreEngine to calculate text width without the escape characters:
Code:
Window_Base.prototype.textWidthEx = function(text) {
    return this.drawTextEx(text, 0, this.contents.height);
};
But it call drawTextEx, so it must draw something, somewhere. Let add a little offset to the function, so it draw a little higher, maybe like 4 pixels.
Code:
Window_Base.prototype.textWidthEx = function(text) {
    return this.drawTextEx(text, 0, this.contents.height - 4);   /// added - 4 pixels
};
Now:
Capture d’écran 2020-08-16 à 14.13.42.png

Seems familiar? I kind of reproduced the 'bug', but without TSR_TextColorAddOn...
If we add a little more offset to it:
Code:
Window_Base.prototype.textWidthEx = function(text) {
    return this.drawTextEx(text, 0, this.contents.height - 32);  // 32 px is default icon height
};

Capture d’écran 2020-08-16 à 14.42.35.png

Yep. Yanfly effectively draw extra jp icons off screen when he call the drawTextWidthEx function.
Not problematic, but not related to TSR_TextColorAddOn. What my plugin does is adjust text fontsize and icon size, which seems to result in bringing those jp icons a little higher...

Now, the best way to fix that is to draw the extra jp icons lower. Adding a lineHeight will ensure the icons will be always offscreen no matter the fontSize (it is also how the function is writen in YEP_coreEngine).

First, find the function in YEP_jobPoints.js file:
Code:
Window_Base.prototype.textWidthEx = function(text) {
    return this.drawTextEx(text, 0, this.contents.height);
};
And edit the function like this:
Code:
Window_Base.prototype.textWidthEx = function(text) {
    return this.drawTextEx(text, 0, this.contents.height + this.lineHeight());
};

Now, you we can turn TSR_TextColorAddOn and the strange tiny line won't be there. 😎 🤘
Hope that'll help!
nicely done TSR, who would have taught of that part 😛, while I dont use it, I
will defenitely make this change anyway 🙂, who knows what good it can bring
for furture use or other peoples problem 😀
@TSR Ah, thank you for taking the time to solve this small problem, it can now be used perfectly! thank you very much!
@ShadowDragon Thank you very much for your enthusiasm too!
Hello all!
A small update: TSR_TextColorAddOn v1.8
  • Just add a parameter for the custom icon sheet to allow the use of rectangle shaped icons of any size.
Regards!
Excellent as always!
Does this work with SRD_customColors or is not compatible?
Hello, I gave a look at his code, and most likely won't be compatible with my plugin. But since the 2 plugins does pretty much the same concerning custom colors, why use both?
Hello, I gave a look at his code, and most likely won't be compatible with my plugin. But since the 2 plugins does pretty much the same concerning custom colors, why use both?
Ah I thought so and I was originally using his to add more then 32 colours until I saw this plugin cause like adding 2 different colours.
I have been trying to figure it out for a few hours but I keep getting this error using the Save core from Yanfly even though I know it compatible it being bugging what wrong with it?
_c[0,32]Final Fanatasy 11_07_2021 19_32_44.png
_c[0,32]Final Fanatasy - RPG Maker MV 11_07_2021 19_31_38.png
_c[0,32]Final Fanatasy - RPG Maker MV 11_07_2021 19_32_02.png
_c[0,32]Final Fanatasy - RPG Maker MV 11_07_2021 19_32_12.png
Hello,
the plugin is compatible with most Yanfly plugin including save core, but for all that other plugins, I don't know. I can see in the background of the screen shot that it happened in yep save scene, but doesn't mean it's not compatible with it, beside it is not refered to in the bug report.

Does the save scene have color/gradient codes in the save core parameters or something?

Also my plugin and ShadowDragon_TF use the exact same gradient functions. Maybe you could start by disabling that one (which is refered in the bug report) and see if it change something.

Original thread: https://forums.rpgmakerweb.com/threads/tsr_textcoloraddon-by-the-northern-frog.121097/