-
Notifications
You must be signed in to change notification settings - Fork 0
Text formatting
Mike edited this page May 27, 2021
·
3 revisions
You can use special symbols in text to add colors and styles to your game.
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 with formating:
TextGameEngine.setStyles(["'lightgreen'", "cu'red'"]);
TextGameEngine.print("&0He^yellow^&ullo&c &b&iworld&1!");
TextGameEngine.print("&0Hello &uworld!");
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;
}