Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Formatting Codes #53

Open
BenCheung0422 opened this issue Dec 24, 2024 · 0 comments
Open

Text Formatting Codes #53

BenCheung0422 opened this issue Dec 24, 2024 · 0 comments

Comments

@BenCheung0422
Copy link
Member

Original: MinicraftPlus/minicraft-plus-revived#392
Requires #26

Background

If we want the style of text looks different, it is restricted to using Unicode codes, and only colors are available, accessibility is quite limited and thus difficult to use. Also, we now have #6 for some special formatting codes. This should not be limited to just coloring when we have the ability for allowing more text styling.

Details

This feature or functionality would generally available globally, but only for rendering or displaying purposes. This would to enhance customizable visual control elements for texts. May refer to Minecraft's implementation and ANSI Select Graphic Rendition (SGR) for implementation details. Since a typeable, uncommon and displayable character must be used, it would still stick with the section sign (§). However, since it is a display character, one code for literal character should be available, which may be §§ like %% in formatter. Here, % is for parameterized texts, so it acts differently, but it might still be available for some functions.

It should not be error-prone. So, to keeping the usability of the codes without ruining the visual experience, unparsable codes will remain literal and not used for styling. This way, it could also inform the user that, the code is invalid, since it is remained literal in rendering.

For extensibility of formatting codes, allowing variety of styling, the implementation might be similar to the SGR. Specifically, they would less likely be just one-character codes, especially when color codes could be supported.

Examples

Format: §<sequences>;

<sequences> can contain one or more formatting codes with colon (:) separators. Likely they are mostly numbers instead of letters due to extensibility, unless there would be options for particular styles.

Sequence Name Note
0 Reset Clear all attributes
1 Bold
2 Italic
3 Underline
4 Strikethrough
11 Not bold Clear bold attribute if it is set
12 Not italic Clear italic attribute if it is set
13 Not underline Clear underline attribute if it is set
14 Not strikethrough Clear strikethrough attribute if it is set
20 Reversed Reverse video
21 Not reversed Clear reversed attribute if it is set
30 Default foreground color Clear set foreground color attribute
31- c Set foreground color Set foreground color by 0-f as seen in Minecraft's one
32 Default background color Clear set background color attribute
33- c Set background color Set background color by 0-f as seen in Minecraft's one

Format: §^<code>;

This would help inputting some special characters, but also help displaying.

Code Character
0 §
1 (EM SPACE)

Different ideas are welcome, even using a different format of control sequent codes.

See Also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant