Changing text colours


Is there any coding that can be used to change the colour of text in choicescript? Not for the entire game, that would just be an eyesore, but for certain parts of the game it would come in really useful. :blush:


ui.js under the printx() function there’s a handful of .replaces, which is the easiest way to insert html. Just create your own. Noteworthy that anything outside standard ChoiceScript can pose a problem to publishing.


… Yeah, I’m going to be honest, I didn’t understand a word of that. Something to do with Javascript? :confused:


As another someone who also didn’t understand but a 'lil bit about that, I think I can explain it to you as this:

To change text colours, you have to modify one (or maybe more) of javascript file(s) which is basically another coding-work.

The problem is, you’ll have to learn javascript coding-technique to not make any mistake while editing the file(s), and doing that means you can’t publish your WIP under Hosted Games nor CoG banner.


Yeah, coding in font color is too difficult for me. It’s already excruciating enough to struggle through CS code. Anyways, here’s a post that might help you:


Wow! I did not think that changing text colour would be so complicated. Maybe I’ll just keep it all the same. :yum:


Yea, basically we don’t support it yet, so if you want it, you have to hack it in.

(Looking back, yea, I kinda assumed a knowledge of the basic JavaScript architecture. Bad form on my part.)


I guess I can assume that it will be supported sooner or later? :smirk:

P.S.: Ah, off-topic. NVM me :v


Lol. I guess most people who use Choicescript have a basic knowledge of Javascript too. Honestly, I’m just kind of figuring everything out as I go along. :yum:


Actually most don’t. Since I already started answering, let me see if I can expand.

In the web folder, there is a file called ui.js or (Although it may just say ui with a JS File as it’s “type”). That’s one of the JavaScript files CS uses to run. In it, the very first function is called function printx. Indented in that function is a number of lines that say .replace(foo, bar) where foo is something like /</g and bar is something like '&lt;' Well that replaces the less than sigh < with the HTML entity &lt;. It’s possible to mess with these (adding or removing some) to start writing HTML into a page.

The side effect is this gets very breakable, very fast.