}.,".;._2 S:0 LF,2!:0'uni -c -f ''%(dec)'' i "''\033[48;2;0;0;0m\033[38;2;255;0;0mHello, \033[48;2;255;0;0m\033[38;2;0;0;0mworld.\033[0m''"'
I don't know of any J primitives or stdlib parts of sentence, that use color. That said, I use some ANSI escape sequences, like bell, frequently.[1] 'echo -n' and 'printf %b\\n' would allow for that.
Using uni[2], with "uni -c -f '%(dec)' i $'\033[48;2;0;0;0m\033[38;1;255;0;0m'" one can get the decimal, ASCII values of the message.
}.,".;._2 S:0 LF,2!:0'uni -c -f ''%(dec)'' i "''\033[48;2;0;0;0m\033[38;2;255;0;0mHello, \033[48;2;255;0
a i.^:(_1) 72 101 108 108 111 44 32 119 111 114 108 100 46 # should be "Hello, world." in bold and red on black, but isn't because escaping is botched
Hello, world.
J's stdlib echo doesn't handle escape sequences.
zsh and bash have a $RANDOM parameter, that can be used to receive a ??-bit number. A script for random color pairings would be easier in a terminal emulator, since it already knows about colors, compared to most programming languages, which most often do not.
[1]
https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
[2]
https://github.com/arp242/uni
May 24, 2024, 08:36 by
dut...@gmail.com:
> Can a string's characters be output using random colors or perhaps by defining the colors using RGB values. Can it be done with / without viewmat or other graphics addon.
> Will it work in jqt and jconsole (Windows) ?
>
>
>
>
> To unsubscribe from this group and stop receiving emails from it, send an email to >
forum+un...@jsoftware.com> .
>