Printing trans flag in compilation

Is there any way to get cargo build to output a trans flag when compiling our crate?

I think terminal support for emoji is usually quite limited. My terminal for sure doesn’t render “:transgender_flag:” correctly. I don’t know how exactly they do it, but I’ve seen crates that print custom messages while being built, so that seems possible, I guess?


Here, e.g. this crate uses eprintln! in a proc macro.

You can use println!("cargo:warning=:transgender_flag:"); I guess. It may get annoying when seeing it on every compilation though. In addition some ides may show a persistent warning even if you as user did nothing wrong.

Hmm, we were thinking of doing good ol' ANSI colors rather than the emoji. We have one of these in our .bash_profile:

C_WHITE=255
C_PINK=213
C_BLUE=123

F_WIDTH=40
F_HEIGHT_MULTIPLIER=3

print_line () {
	printf '\x1b[48;5;%sm' $1
	for ((i=0; i<$F_WIDTH; i++)); do
		printf " "
	done
	printf "\x1b[0m"
	printf "\n"
}

print_color () {
	for ((j=0; j<$F_HEIGHT_MULTIPLIER; j++)); do
		print_line "$1"
	done
}

print_color $C_BLUE
print_color $C_PINK
print_color $C_WHITE
print_color $C_PINK
print_color $C_BLUE

but we're not sure how to properly detect color support and adjust to an ASCII-based variant as needed and whatnot.

Ah, I see. That’s something I hadn’t thought of :slight_smile:


Note that, AFAIK, people usually don’t expect crates to print extra stuff during building their crates, so such a printout, particularly a (somewhat) big ASCII-art-ish output, might not be appreciated by too many people.

Really the only cases of printouts during builds (as far as I remember) was for crates – such as the one I linked above – that deliberately are not intended for production, and want to warn users in case any of their dependencies use them nonetheless.

Especially given the fact that many Rust projects have loads of dependencies, imagine the clutter if everyone started printing – potentially unwanted – stuff/messages into the terminal. This kind of discussion reminds me of instances of packages displaying full-block (terminal) advertisements during builds on npm that I’ve read about some time ago. (I don’t remember what exactly I read, but the article I linked is some article covering the topic.)


Maybe symbols like trans flags are better placed in other places, e.g. into the documentation of your crate. (Where you’ll even have proper emoji support.) And/or you could incorporate it into your crate’s custom icon or logo.


Unless, of course, if this is just a technical challenge you’re trying to solve for fun, not for use in “production” crates, then of course go ahead!

7 Likes

We mean... github pages still doesn't support the emoji. Using ASCII-art-ish works for identities that aren't in unicode, like autgender. There are definitely tradeoffs, but, yeah.

What do you mean? They definitely should support full Unicode, since, well, the text is shown as-is. And they can't be expected to support the emoji mnemonics, since, well... they are not a part of any markup, AFAIK.

I think few systems display correctly that particular code point U+1F3F3 FE0F 200D 26A7 FE0F, it's still relatively new, being from version 13 of unicode. (unless they use images like discourse)

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.