RuneScape Text

Convert text to a text image with RuneScape chat effects.
More examples
Refer to this wikiHow guide on How to Write Text Effects on RuneScape.
Getting started
npm i runescape-text
Examples
npx runescape-text "wave:glow3: hello world"
const fs = require("fs");
const getRuneScapeText = require("runescape-text");
async function main() {
const string = "wave:glow3: hello world";
const options = { showLogs: true };
const { extension, buffer } = getRuneScapeText(string, options);
fs.writeFileSync(`./runescape-text.${extension}`, await buffer);
}
main();
Syntax
getRuneScapeText(string, [options], [wordWrapOptions]);
Parameters
| Parameter |
Type |
Required |
Default |
Description |
| string |
string |
Yes |
none |
Text to convert |
| options |
Object |
No |
{} |
Options to configure script behavior |
| wordWrapOptions |
Object |
No |
{} |
Options to configure word-wrap behavior |
Options
| Property |
Type |
Required |
Default |
Description |
| version |
string |
No |
"osrs" |
Game version to use, either: osrs or rs3 |
| color |
string |
No |
"yellow" |
Default color effect of the text, either: yellow, red, green, cyan, purple, white, glow1, glow2, glow3, flash1, flash2, or flash3 |
| motion |
string |
No |
"none" |
Default motion effect of the text, either: none, wave, wave2, shake, scroll, or slide |
| suffix |
string |
No |
":" |
String that should suffix each color and motion string |
| replacement |
string |
No |
"" |
String to replace characters the font does not support |
| maxMessageLength |
number |
No |
280 |
Max message length allowed after the string has been sanitized |
| scale |
number |
No |
2 |
Scale factor of the font (multiples of 16px), prefer integer values greater than or equal to 1, decimal values will render blurry text |
| fps |
number |
No |
20 |
Frames per second to render animations at, prefer integer values less than or equal to 60 |
| cycleDuration |
number |
No |
3000 |
Duration in milliseconds of one cycle before the animation loops |
| quality |
number |
No |
100 |
Quality to render animations at, more information here |
| showLogs |
boolean |
No |
false |
Determines whether to print runtime logs or not |
WordWrapOptions
Property information can be found here. The defaults chosen by this module are listed below:
| Property |
Default |
| width |
50 |
| indent |
"" |
| newline |
"\n" |
| escape |
(str) => str.trimEnd() |
| trim |
false |
| cut |
false |
Return value
The return value is an Object with the following properties:
| Property |
Type |
Description |
| width |
number |
Image width |
| height |
number |
Image height |
| extension |
string |
File extension, either: png or gif |
| buffer |
Promise<Buffer> |
Promise resulting in an image buffer |
Exceptions
| Error |
Description |
InvalidArgumentError |
Thrown if required string argument is missing |
TypeError |
Thrown if argument type is unexpected |
ValueError |
Thrown if string is empty |
ValueError |
Thrown if the parsed message string is empty |