Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

SOLVED! Emoji flipping & coloring - rainbow trumpets facing both directions!

Jul
269
6
So, I'm trying to learn how to flip emoji.
I was provided a solution for PowerShell that I can't quite get working in TCC.

The code is:

Code:
printf '\eP0;8;1;10;0;2;20;0{ @???~}{wo_?/[MFJp@@@@@/GCA@??????/??????????;?_ow{}~???/@@@@@pJFM[/??????@ACG/??????????;??????????/??_ogKYr}{/?_ow\\NVb`O/@B@???????;??????????/{}rYKgo_??/O`bVN\\wo_?/???????@B@\e\\'

printf '\e( @\e[33m*(\e(B \e[36mThis is an important message \e( @\e[33m)+\e(B\e[m\n'

And works fine on bash:
1705851228645.png


However, when I do the same in TCC (using quotes around the argument instead of apostrophes, as one does), it doesn't display, despite me being in the same window with the same terminal display capabilities:

1705851425642.png



I think my printf needs to change under TCC, but I'm not sure where its' going wrong.

Any ideas?
 
This looks like a... stunningly byzantine way of displaying characters. You can display text with ECHO, and insert arbitrary characters with @CHAR:

Code:
echo %@char[0xd83c 0xdfba] This is an important message %@char[0xd83c 0xdfba]

I have not succeeded in making the Unicode emoji direction sequences work here. That may be because (A) I'm using Windows 10 and it does not support them, or (B) I haven't found any very good documentation on them and don't entirely grok them. Probably both of the above. But it should just involve adding a ZWJ (0x200D), a direction character (not well documented?), and a variant selector (0xFE0F) in the @CHAR function.

As for TCC's PRINTF? I don't use it. I don't even understand why it's there.
 
One issue (I'd bet there are more) ... In TCC, the escape character (0x1B) is ^e (not \e).

1705855138341.png
 
So, the problem turned out to be that TCC's internal printf did not behave the same as cygwin's.

I actually got these working. And the added benefit is that the newly defined trumpets accept ansi coloring, so I didn't just unlock flipped trumpets, but rainbow trumpets!

1705855353602.png
 
The solution is to set up a custom character set for the 2 trumpet emojis like this:

Code:
c:\cygwin\bin\printf.exe "\eP0;8;1;10;0;2;20;0{ @???~}{wo_?/[MFJp@@@@@/GCA@??????/??????????;?_ow{}~???/@@@@@pJFM[/??????@ACG/??????????;??????????/??_ogKYr}{/?_ow\\NVb`O/@B@???????;??????????/{}rYKgo_??/O`bVN\\wo_?/???????@B@\e\\"

(I'm using printf because that's what was used by the person who provided the solution. This absolutely could be decomposed to an echo statement, i just haven't bothered yet)

Once those are defined, the trumpets can be defined as environment variables (the first is original trumpet, the 2nd is custom character set trumpet, the 3rd is FLIPPED custom character set trumpet):

Code:
EMOJI_TRUMPET=%@CHAR[55356]%@CHAR[57274]
EMOJI_TRUMPET_COLORABLE=%ESCAPE( @*(%ESCAPE%(B
EMOJI_TRUMPET_FLIPPED=%ESCAPE( @)+%ESCAPE%(B

I can then define message decorators to create rainbow trumpets facing the message:

Code:
set DECORATOR_LEFT=%ANSI_RED%%EMOJI_TRUMPET_COLORABLE%%@ANSI_FG[255,127,0]%EMOJI_TRUMPET_COLORABLE%%@ansi_fg[212,234,0]%EMOJI_TRUMPET_COLORABLE%%ANSI_BRIGHT_GREEN%%EMOJI_TRUMPET_COLORABLE%%ANSI_BRIGHT_BLUE%%EMOJI_TRUMPET_COLORABLE%%@ANSI_FG[200,0,200]%EMOJI_TRUMPET_COLORABLE%  %ANSI_RESET%%@ANSI_FG_RGB[76,0,76]%reverse_on%%blink_on%%EMOJI_FLEUR_DE_LIS%%blink_off%%reverse_off%%ANSI_COLOR_IMPORTANT% ``
set DECORATOR_RIGHT= %ANSI_RESET%%@ANSI_FG_RGB[76,0,76]%reverse_on%%blink_on%%EMOJI_FLEUR_DE_LIS%%blink_off%%reverse_off%%ANSI_COLOR_IMPORTANT%  %@ANSI_FG[200,0,200]%EMOJI_TRUMPET_FLIPPED%%ANSI_BRIGHT_BLUE%%EMOJI_TRUMPET_FLIPPED%%ANSI_BRIGHT_GREEN%%EMOJI_TRUMPET_FLIPPED%%@ansi_fg[212,234,0]%EMOJI_TRUMPET_FLIPPED%%@ANSI_FG[255,127,0]%EMOJI_TRUMPET_FLIPPED%%ANSI_RED%%EMOJI_TRUMPET_FLIPPED%)

Note that anyone actually trying to implement this is going to need the TCC functions i use to set RGB colors via ansi [these are all the same function, i just make aliases so i don't have to remember word orders as much]:

Code:
function        ANSI_RGB=`%@CHAR[27][38;2;%1;%2;%3m`
              function     ANSI_FG=`%@CHAR[27][38;2;%1;%2;%3m`         
              function ANSI_RGB_FG=`%@CHAR[27][38;2;%1;%2;%3m`     
              function ANSI_FG_RGB=`%@CHAR[27][38;2;%1;%2;%3m`


There's a few other environment variables i use like "ANSI_GREEN" and such, if you REALLY want it ALL, i attached my set-colors.bat which defines my ansi environment variables, and my set-emoji.bat which defines my emoji environment variables
 

Attachments

  • set-colors.bat
    21.2 KB · Views: 6
  • set-emojis.bat
    1.6 KB · Views: 5
  • emojienv.txt
    65.2 KB · Views: 8
You can always count on me to bring up weird esoteric console stuff.
 
P.S. I'm on windows 10.
 
As a completely unnecessary show-and-tell...

I have an emoji and a color associated with each machine in my network. They are defined as environment variables and used in scripts (example below).

Well now, I intend to change Wyvern's castle emoji's color to also be purple, instead of grey, and Demona's devil face emoji to be the skin color of the character Demona from Gargoyles that the machine is named after, instead of red.

IMPORTANT STUFF, hahahaha

But seriously, I want to beautify all my old bat files and make them use modern feature, and this has ben a really fun way to learn esoteric console, ANSI, emoji, and unicode stuff.


1705857128257.png
 
In that TCC thing I last posted, in the first command, there are a pair of backticks (``). They disappear when TCC executes the command. The command works just as well if they're simply removed!

1705857658207.png
 
The following should work too ... I used direct the ESC char ...
 

Attachments

  • ColorTestDirect.btm
    65 bytes · Views: 8
Back
Top