Skip to content

Text formatting

Mike edited this page May 27, 2021 · 3 revisions

Text formatting

You can use special symbols in text to add colors and styles to your game.

Special symbols:

Symbol Meaning
&c Clear style
&b Bold style
&i Italic style
&u Underline style
&digit your style by this number (0-9) in styles
\& & symbol
^color^ Color
^number^ your style by this number in styles
\^ ^ symbol
[linkText:link] Link
\[text:text] Not link

Set your own styles and colors:

TextGameEngine.setStyles(styles: string[], useStyles: boolean)

Call before TextGameEngine.init() if you want to use formatting in headers.

useStyles - default true, set to false to disable text formatting

Strings in styles can contain:

  • c - Clear style
  • b - Bold style
  • i - Italic style
  • u - Underline style
  • color in single quotes

Style string examples:

  • ui'red' - Underline, Italic, red
  • 'blue'i - Italic, blue
  • 'rgb(50, 220, 120)' - rgb(50, 220, 120) color
  • cb'#ffff00' - Clear privious styles, bold, #ffff00 color

Text without formating:

TextGameEngine.print("Hello world!");

Text without formating

Text with formating:

TextGameEngine.setStyles(["'lightgreen'", "cu'red'"]);
TextGameEngine.print("&0He^yellow^&ullo&c &b&iworld&1!");

Text with formating

TextGameEngine.print("&0Hello &uworld!");

Text with formating

Change Colors

All colors are in the first lines of the css file.

/* TextGameEngine-styles.css */
.theme-light {
	--color-back--: antiquewhite;
	--color-input--: white;
	--color-main--: #b5f392;
	--color-text--: black;
	--color-link--: blue;
	--color-choosen-option--: lightgreen;
}
.theme-dark {
	--color-back--: #0d1418;
	--color-input--: #0b2a3d;
	--color-main--: #0f9e38;
	--color-text--: white;
	--color-link--: #00ffff;
	--color-choosen-option--: darkgreen;
}
Clone this wiki locally