I believe there's a slight bug in the color mapping in the distance function using HSL, because hue is cyclic for instance, the distance between hsl(359, 100, 50) and hsl(0, 100, 50) should be 1^2, but is calculated as 359^2 this probably only means that the closest match for reddish colors are slightly worse than for other colors (the second best match is selected), so the image looks fine, but you'll probably get better reds fixing this. Also, the fact that H has a bigger maximum size to S and L might answer why you didn't have to tinker with multipliers on the distance function to get a nice result
I guess, the reason why the RGB version didn't work was because \e[38 sets the foreground color. Consequently, the code printed spaces of different colors on the default background, hence nothing. The suckless terminal is claimed to support true colors, so if anything but space was printed or if \e[48 was used, the terminal should've shown the palette.
Your terminal probably supports RGB colours, too - you could use this to skip the mapping step completely: en.wikipedia.org/wiki/ANSI_escape_code#24-bit
A bit late to the party but i feel like the true color didn't work because it had 38 as a code and that's for the foreground, printing a space had nothing to color
2:13 ohhhh I know that one. That's EXACTLY how the TypeScript Language server renders `\x1b[`. It's the Control Sequence Introducer. EDIT: lol 5 seconds later you figured it out. EDIT 2: 12:19 that's a great idea.