Paste format: Difference between revisions

From Our World of Text Wiki
Jump to navigation Jump to search
Itac85v2 (talk | contribs)
m Changed "I" to "you"
Jan soweli Asike (talk | contribs)
m small changes
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:


== Escape characters ==
== Escape characters ==
With the exception of text decorations, all character attribute changes (i.e. links, colors) are prefixed by an '''escape character''' (<code>U+001B</code>), followed by an escape code. After an escape code is written, it must either be followed by a segment of text, '''or''' followed by another escape code. The list of all possible escape codes can be seen below.
With the exception of text decorations, all character attribute changes (links, colors, and protections) are prefixed by an '''escape character''' (<code>U+001B</code>), followed by an escape code. After an escape code is written, it must either be followed by a segment of text, '''or''' followed by another escape code. The list of all possible escape codes can be seen below.


=== Changing colors ===
=== Changing colors ===
<small>'''''Important''': For best performance, you may (optionally) write the escape codes listed below by each <u>change</u>, rather than by each character. This condition only applies for setting/resetting colors.''</small>
<small>'''''Important''': For best performance, you may (optionally) write the following escape codes for each <u>change</u> in value, rather than just for each character. This condition only applies for setting and resetting colors.''</small>


==== Text colors ====
==== Text colors ====
To change the current text color, you'd write an escape character (<code>\x1B</code>), followed by the capital letter <code>F</code>, followed by a hex-encoded RGB value.
To change the current text color, you would write an escape character (<code>\x1B</code>), followed by the capital letter <code>F</code>, followed by a hex-encoded RGB value.


Example: To change the current text color to a pure green, you'd write the sequence <code>\x1BF00ff00</code>.
Example: To change the current text color to a pure green, you would write the sequence <code>\x1BF00ff00</code>.


==== Cell colors ====
==== Cell colors ====
Changing the cell color works very similarly to changing the text color. The formatting begins with an escape character (<code>\x1B</code>), followed by the lowercase letter <code>b</code>, finally ending with a hex-encoded RGB value.
Changing the cell color works very similarly to changing the text color. The formatting begins with an escape character (<code>\x1B</code>), followed by the lowercase letter <code>b</code>, finally ending with a hex-encoded RGB value.


Example: To set the current background color to a pure magenta, you'd write the sequence <code>\x1Bbff00ff</code>.
Example: To set the current background color to a pure magenta, you would write the sequence <code>\x1Bbff00ff</code>.


==== Resetting colors ====
==== Resetting colors ====
To reset the currently set color, you'd simply write an escape character (<code>\x1B</code>), immediately followed by the lowercase letter <code>x</code>. Keep in mind that this will reset '''all''' colors (including text and cell colors) to the default text color, as defined in the world's [https://wiki.ourworldoftext.com/wiki/World#World_Settings configuration settings].
To reset the currently set color, you would simply write an escape character (<code>\x1B</code>), immediately followed by the lowercase letter <code>x</code>. Keep in mind that this will reset '''both'' text '''and''' cell colors to their default values, as defined in the world's [https://wiki.ourworldoftext.com/wiki/World#World_Settings configuration settings].


=== Links & protections ===
=== Links & protections ===
Line 27: Line 27:
In order to apply a link to some text, you first write an escape character (<code>\x1B</code>), then the characters <code>$u</code>, and ending with stringified text, '''including the quotes''', containing the contents of your link.
In order to apply a link to some text, you first write an escape character (<code>\x1B</code>), then the characters <code>$u</code>, and ending with stringified text, '''including the quotes''', containing the contents of your link.


Example: If you wanted to apply the link <code><nowiki>http://owot.me</nowiki></code> to the text "<code>hi</code>", you would write <code>\x1B$u"<nowiki>http://a</nowiki>"h\x1B$u"<nowiki>http://a</nowiki>"i</code>.
Example: If you wanted to apply the link <code><nowiki>http://owot.me</nowiki></code> to the text "<code>hi</code>", you would write <code>\x1B$u"<nowiki>http://owot.me</nowiki>"h\x1B$u"<nowiki>http://owot.me</nowiki>"i</code>.


=== Protections ===
=== Protections ===
To apply protections to some text, you start by writing an escape character (<code>\x1B</code>), followed by a '''protection value.'''  The protection value can be one of <code>P0</code> (public), <code>P1</code> (members-only), or <code>P2</code> (owner-only).
To apply protections to some text, you start by writing an escape character (<code>\x1B</code>), followed by a '''protection value.'''  The protection value can be one of <code>P0</code> (public), <code>P1</code> (members-only), or <code>P2</code> (owner-only).


Example: To apply an owner-only protection to the text "sample", you'd write <code>\x1BP2s\x1BP2a\x1BP2m\x1BP2p\x1BP2l\x1BP2e</code>.
Example: To apply an owner-only protection to the text "sample", you would write <code>\x1BP2s\x1BP2a\x1BP2m\x1BP2p\x1BP2l\x1BP2e</code>.


== Text decorations ==
== Text decorations ==

Latest revision as of 12:38, 25 March 2025

The purpose of this article is to document how Our World of Text's paste format works, which refers to the structure and composition of Unicode characters produced by the built-in area selection tool.

Note: This article does not document the pasting mechanic itself; for that information, see Pasting.

Escape characters

With the exception of text decorations, all character attribute changes (links, colors, and protections) are prefixed by an escape character (U+001B), followed by an escape code. After an escape code is written, it must either be followed by a segment of text, or followed by another escape code. The list of all possible escape codes can be seen below.

Changing colors

Important: For best performance, you may (optionally) write the following escape codes for each change in value, rather than just for each character. This condition only applies for setting and resetting colors.

Text colors

To change the current text color, you would write an escape character (\x1B), followed by the capital letter F, followed by a hex-encoded RGB value.

Example: To change the current text color to a pure green, you would write the sequence \x1BF00ff00.

Cell colors

Changing the cell color works very similarly to changing the text color. The formatting begins with an escape character (\x1B), followed by the lowercase letter b, finally ending with a hex-encoded RGB value.

Example: To set the current background color to a pure magenta, you would write the sequence \x1Bbff00ff.

Resetting colors

To reset the currently set color, you would simply write an escape character (\x1B), immediately followed by the lowercase letter x. Keep in mind that this will reset both text and' cell colors to their default values, as defined in the world's configuration settings.

Links & protections

Important: The escape codes listed here must be applied to each character in a text.

In order to apply a link to some text, you first write an escape character (\x1B), then the characters $u, and ending with stringified text, including the quotes, containing the contents of your link.

Example: If you wanted to apply the link http://owot.me to the text "hi", you would write \x1B$u"http://owot.me"h\x1B$u"http://owot.me"i.

Protections

To apply protections to some text, you start by writing an escape character (\x1B), followed by a protection value. The protection value can be one of P0 (public), P1 (members-only), or P2 (owner-only).

Example: To apply an owner-only protection to the text "sample", you would write \x1BP2s\x1BP2a\x1BP2m\x1BP2p\x1BP2l\x1BP2e.

Text decorations

Text decorations (such as bold, italics, underline, and strikethrough), are stored differently than colors & links. Instead of using escape codes, text decorations utilize Unicode combining characters to store a single character's state. Unlike escape codes, combining characters succeed a character, rather than preceding it.

OWOT uses the Unicode code point range U+20F1 to U+20FF to store text decorations. The specific code point to be used is determined by encoding a character's formatting in binary (offset by a hex value of 0x20F0). The bit order for each decoration is the same as it appears on the official client's text decorations menu, and setting a bit to 1 enables a decoration.

Example: If you wanted to make the character "A" appear bold and italicized, you would write A\u20FC.