Skip to main content
8 events
when toggle format what by license comment
Feb 14, 2022 at 3:34 comment added Oo'- @StéphaneChazelas, is there how to convert XTERM colour format to ANSI colour format?
Mar 12, 2016 at 22:02 comment added user79743 Ah, tohex added to my answer, A bit longer than what I was expecting, but the 256 colors have quite a bit of quirk turns.
Mar 12, 2016 at 21:55 comment added user79743 @StéphaneChazelas Using another terminal program (gnome-terminal) (which is a xterm terminal) I got your code to work correctly (both in bash and zsh) Oddly enough: tput colors reports only 8 even if the terminal is capable of presenting 256 colors. Also, the xterm-color (Konsole) tput colors only reports 8 even if that terminal is fully capable of presenting 16 million colors (and all 256 colors, of course). And no, no tmux or screen that may "color" :-) (change that is) the results (I was aware of that detail). In short: your code may fail in some terminal/consoles.
Mar 12, 2016 at 7:34 history edited Stéphane Chazelas CC BY-SA 3.0
added 88 characters in body
Mar 12, 2016 at 7:06 comment added Stéphane Chazelas @Gilles, you want the query to be sent via the prompt after the terminal discipline echo is disabled. See edit.
Mar 12, 2016 at 7:05 history edited Stéphane Chazelas CC BY-SA 3.0
revert Gilles' edit, add equivalent bash variant
Mar 11, 2016 at 19:22 history edited Gilles 'SO- stop being evil' CC BY-SA 3.0
might as well show a way that works in bash; add a timeout to make this more robust on terminals that don't support the escape sequence
Mar 11, 2016 at 16:57 history answered Stéphane Chazelas CC BY-SA 3.0