« IRC Colors en JavaScript » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
(Une version intermédiaire par le même utilisateur non affichée) | |||
Ligne 63 : | Ligne 63 : | ||
Red text on a blue background would be: | Red text on a blue background would be: | ||
< | <syntaxhighlight lang="javascript">bot.say("#canal", "\x0304,02Example\x03")</syntaxhighlight> | ||
==Other formatting== | ==Other formatting== | ||
Ligne 91 : | Ligne 91 : | ||
== Function JavaScript converter == | == Function JavaScript converter == | ||
< | <syntaxhighlight lang="javascript"> | ||
function formattingColorIRC(str) { | function formattingColorIRC(str) { | ||
Ligne 114 : | Ligne 114 : | ||
formattingColorIRC("�0,4test"); //Result=\x030,4test | formattingColorIRC("�0,4test"); //Result=\x030,4test | ||
</ | </syntaxhighlight> | ||
==Mots clés== | ==Mots clés== | ||
control characters, IRC colors, IRC colours, caret notation, irc colors javascript, converter irc colors for bot javascript or tcl | control characters, IRC colors, IRC colours, caret notation, irc colors javascript, converter irc colors for irc bot javascript or tcl |
Dernière version du 1 mai 2024 à 06:11
Generator
https://www.wiki-irc.com/colormirctojs.html
IRC Color Code
Number | Name |
00 | white / blanc |
01 | black / noir |
02 | blue (navy) / bleu marine |
03 | green / vert |
04 | red / rouge |
05 | brown (maroon) / marron |
06 | purple / violet |
07 | orange (olive) / orange |
08 | yellow / jaune |
09 | light green (lime) / vert clair |
10 | teal (a green/blue cyan) / turquoise (un cyan vert / bleu) |
11 | light cyan (cyan / aqua) / cyan clair |
12 | light blue (royal) / bleu clair |
13 | pink (light purple / fuchsia) / rose |
14 | grey / gris |
15 | light grey (silver) / gris clair |
Example
Red text on a blue background would be:
bot.say("#canal", "\x0304,02Example\x03")
Other formatting
Code | Meaning |
\x02 | bold |
\x03 | colored text |
\x1D | italic text |
\x1F | underlined text |
\x16 | swap background and foreground colors ("reverse video") |
\x0F | reset all formatting |
Function JavaScript converter
function formattingColorIRC(str) {
// color
str = str.replace(/\x03/g, "\\x03" );
// bold
str = str.replace(/\x02/g, "\\x02" );
// italic
str = str.replace(/\x1D/g, "\\x1D" );
// underline
str = str.replace(/\x1F/g, "\\x1F" );
// swap background and foreground colors
str = str.replace(/\x16/g, "\\x16" );
return str;
}
formattingColorIRC("�0,4test"); //Result=\x030,4test
Mots clés
control characters, IRC colors, IRC colours, caret notation, irc colors javascript, converter irc colors for irc bot javascript or tcl