Skip to content
This repository was archived by the owner on Apr 26, 2025. It is now read-only.
This repository was archived by the owner on Apr 26, 2025. It is now read-only.

print raw ANSI escaped string #49

@qkzk

Description

@qkzk

Hello there,

I've used tuikit in several projects and I'm very found of it. Thanks for your work !

Currently I'm working on a file manager which can preview some files.
I made a simple thumbnail preview, but the result is really ugly :)

I've found a nice program chafa which converts any image to an ANSI escaped string.

Is there a way to print an ANSI escaped string directly in a term ?

Is there another way than using a term ? Like print this in "window" of some kind. I don't care if it takes the whole screen.

I thought about, "pause" the term, releasing stdout, clear, print the ansi escaped string, "unpause" the term... but I've absolutely no idea about how to do that.

I thought about parsing the string (with something like ansi-parser or ansi-to-tui) but both requires quite some work to be compatible with print_with_attr...

Below an example of chafa output.

Thanks in advance :)

�[0m�[38;2;105;85;66;48;2;109;87;66m▗�[38;2;115;93;72;48;2;105;85;64m▝�[38;2;113;93;75;48;2;129;107;87m▖�[38;2;134;114;92;48;2;141;119;95m▅�[38;2;137;117;94;48;2;143;122;100m▖�[38;2;143;124;104;48;2;148;127;107m▖�[38;2;155;134;113;48;2;151;130;109m▝�[38;2;155;136;115;48;2;160;139;119m▄�[38;2;158;141;119;48;2;164;145;123m▖�[38;2;167;148;124;48;2;171;151;127m▅�[38;2;165;146;121;48;2;169;149;124m▂�[38;2;166;146;121;48;2;161;143;121m▍�[38;2;160;142;118;48;2;161;143;122m▋�[38;2;165;145;128;48;2;172;152;136m▌�[38;2;173;154;139;48;2;176;159;145m▎�[38;2;170;151;135;48;2;178;159;145m▄�[38;2;138;121;96;48;2;162;143;125m▗�[38;2;140;124;100;48;2;107;90;69m▘�[38;2;64;56;44;48;2;91;76;61m▄�[38;2;62;56;46;48;2;46;43;37m▘�[38;2;45;44;39;48;2;53;51;47m▌�[38;2;55;53;49;48;2;71;64;62m▄�[38;2;56;53;50;48;2;79;73;70m▄�[38;2;62;60;55;48;2;81;75;71m▅�[38;2;62;61;52;48;2;79;74;66m▄�[38;2;58;61;52;48;2;70;68;60m▄�[38;2;54;58;46;48;2;64;63;53m▅�[38;2;48;55;40;48;2;62;63;50m▅�[38;2;44;56;39;48;2;58;62;48m▅�[38;2;37;54;34;48;2;47;60;42m▅�[38;2;32;51;30;48;2;36;57;33m▄�[38;2;30;48;28;48;2;37;57;33m▅�[38;2;28;46;26;48;2;34;54;30m▅�[38;2;26;45;25;48;2;32;52;27m▅�[38;2;23;42;22;48;2;29;48;24m▅�[38;2;22;41;20;48;2;28;48;23m▆�[38;2;21;41;19;48;2;36;54;32m▆�[38;2;26;47;24;48;2;39;63;39m▅�[38;2;31;53;29;48;2;45;70;44m▅�[38;2;33;56;28;48;2;44;70;40m▄�[38;2;32;56;28;48;2;40;64;36m▃�[38;2;33;60;31;48;2;36;64;34m▂�[38;2;34;60;32;48;2;37;63;34m▄�[38;2;38;65;36;48;2;37;64;34m▝�[38;2;38;64;34;48;2;39;67;37m▗�[38;2;39;66;36;48;2;41;69;40m▍�[38;2;46;78;47;48;2;44;75;44m▝�[38;2;49;82;48;48;2;53;87;54m▍�[38;2;64;98;65;48;2;57;90;57m▝�[38;2;56;89;56;48;2;61;94;59m▃�[38;2;47;75;45;48;2;53;83;50m▗�[38;2;47;73;44;48;2;40;67;36m▍�[38;2;41;71;40m▂�[38;2;42;70;38m▅�[38;2;38;65;33;48;2;41;68;37m▂�[38;2;31;62;30;48;2;36;64;33m▗�[38;2;31;61;30;48;2;33;62;31m▂�[38;2;34;64;33;48;2;31;60;29m▂�[38;2;38;70;38;48;2;31;60;28m▂�[38;2;38;69;37;48;2;31;59;28m▅�[38;2;46;79;47;48;2;38;68;36m▂�[38;2;47;81;49;48;2;45;74;43m▄�[38;2;48;79;47;48;2;43;75;43m▖�[38;2;41;75;42;48;2;37;67;36m▄�[38;2;42;73;41;48;2;36;64;33m▅�[38;2;44;73;42;48;2;39;68;37m▃�[38;2;40;69;38;48;2;43;73;41m╸�[38;2;42;72;40;48;2;46;78;42m▂�[38;2;52;86;50;48;2;48;80;45m▝�[38;2;50;80;48;48;2;60;92;55m▅�[38;2;50;79;48;48;2;58;88;54m▅�[38;2;48;78;45;48;2;51;84;47m▖�[38;2;53;87;50;48;2;58;91;56m▌�[38;2;58;94;58;48;2;61;98;61m▖�[38;2;64;101;62;48;2;58;94;56m▆�[38;2;66;103;61;48;2;55;92;50m▃�[38;2;68;105;62;48;2;53;90;47m▄�[38;2;71;108;64;48;2;57;94;51m▃�[38;2;70;108;64;48;2;55;94;50m▃�[38;2;69;108;63;48;2;56;95;51m▃�[38;2;69;111;65;48;2;58;96;53m▄�[38;2;69;112;68;48;2;60;100;60m▄�[38;2;74;116;72;48;2;63;103;63m▅�[38;2;76;123;77;48;2;69;109;68m▅�[38;2;83;130;82;48;2;72;114;70m▄�[38;2;86;134;84;48;2;73;117;69m▄�[38;2;83;131;81;48;2;70;115;66m▅�[38;2;82;129;78;48;2;72;118;69m▆�[38;2;87;131;84;48;2;77;122;71m▃�[38;2;89;129;82;48;2;81;122;72m▃�[38;2;83;127;77;48;2;77;121;70m▇�[38;2;81;125;77;48;2;77;124;71m▄�[38;2;74;118;70;48;2;79;127;73m▅�[38;2;75;115;71;48;2;83;128;78m▂�[38;2;79;121;73;48;2;72;113;66m▎�[38;2;67;109;63;48;2;65;105;60m▍�[38;2;75;112;68;48;2;69;107;62m▝�[38;2;71;111;64;48;2;75;118;70m▅�[38;2;68;107;60;48;2;74;116;68m▅�[38;2;54;88;43;48;2;62;99;53m▗�[38;2;56;92;46;48;2;49;82;37m▘�[38;2;48;83;39;48;2;41;76;34m▅�[38;2;51;88;43;48;2;42;77;34m▂�[38;2;53;91;47;48;2;42;76;34m▁�[38;2;45;79;39;48;2;36;66;28m▃�[38;2;43;77;36;48;2;48;79;38m▅�[38;2;44;80;40;48;2;43;76;33m▁�[38;2;45;77;36;48;2;36;67;27m▖�[38;2;33;64;24;48;2;25;54;16m▃�[38;2;35;67;23;48;2;23;58;14m▂�[38;2;33;70;20;48;2;48;85;34m▌�[38;2;59;97;47;48;2;51;90;40m▄�[38;2;72;113;62;48;2;60;99;52m▃�[38;2;91;132;80;48;2;81;120;72m▗�[38;2;88;129;81;48;2;75;115;67m▄�[38;2;77;115;68;48;2;67;105;58m▅�[0m

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions