notcurses-info: use some coloring #1823

This commit is contained in:
nick black 2021-06-24 19:12:16 -04:00 committed by Nick Black
parent 5f06c2eef9
commit b1fd24a970
4 changed files with 27 additions and 1 deletions

View File

@ -256,6 +256,16 @@ target_link_libraries(notcurses-static
PUBLIC
notcurses-core-static
)
if(${USE_READLINE})
target_link_libraries(notcurses
PUBLIC
"${READLINE_LIBRARIES}"
)
target_link_libraries(notcurses-static
PUBLIC
"${READLINE_LIBRARIES}"
)
endif()
if(${USE_FFMPEG})
target_include_directories(notcurses
PRIVATE

View File

@ -20,6 +20,7 @@ capbool(const tinfo* ti, bool cap){
static int
unicodedumper(const struct notcurses* nc, struct ncplane* n, tinfo* ti, const char* indent){
ncplane_set_fg_rgb(n, 0x9172ec);
ncplane_printf(n, "%sutf8%lc quad%lc sex%lc braille%lc images%lc videos%lc\n",
indent,
capbool(ti, ti->caps.utf8),
@ -28,7 +29,14 @@ unicodedumper(const struct notcurses* nc, struct ncplane* n, tinfo* ti, const ch
capbool(ti, ti->caps.braille),
capbool(ti, notcurses_canopen_images(nc)),
capbool(ti, notcurses_canopen_videos(nc)));
ncplane_set_fg_default(n);
if(ti->caps.utf8){
/*uint32_t l = CHANNEL_RGB_INITIALIZER(0x20, 0x20, 0x20);
uint32_t r = CHANNEL_RGB_INITIALIZER(0x80, 0x80, 0x80);
int y, x;
ncplane_cursor_yx(n, &y, &x);
ncplane_highgradient_sized(n, l, r, l, r, 10, ncplane_dim_x(n));
ncplane_cursor_move_yx(n, y, x);*/
ncplane_printf(n, " {%ls} {%ls} ⎧%.122ls⎫ ⎧█ ⎫ 🯰🯱\n",
NCHALFBLOCKS, NCQUADBLOCKS, NCSEXBLOCKS);
ncplane_printf(n, " ⎩%ls⎭ ⎪🮋▏⎪ 🯲🯳\n",
@ -57,6 +65,7 @@ unicodedumper(const struct notcurses* nc, struct ncplane* n, tinfo* ti, const ch
static void
tinfo_debug_bitmaps(struct ncplane* n, const tinfo* ti, const char* indent){
ncplane_set_fg_rgb(n, 0x5efa80);
if(!ti->pixel_draw){
ncplane_printf(n, "%sdidn't detect bitmap graphics support\n", indent);
}else if(ti->sixel_maxy){
@ -85,6 +94,8 @@ capyn(const tinfo* ti, const char* cap){
static void
tinfo_debug_caps(struct ncplane* n, const tinfo* ti, const char* indent){
ncplane_putchar(n, '\n');
ncplane_set_fg_rgb8(n, 0xcc, 0x99, 0xff);
ncplane_printf(n, "%srgb%lc ccc%lc af%lc ab%lc appsync%lc u7%lc cup%lc vpa%lc hpa%lc sgr%lc sgr0%lc op%lc fgop%lc bgop%lc\n",
indent,
capbool(ti, ti->caps.rgb),
@ -101,12 +112,15 @@ tinfo_debug_caps(struct ncplane* n, const tinfo* ti, const char* indent){
capyn(ti, get_escape(ti, ESCAPE_OP)),
capyn(ti, get_escape(ti, ESCAPE_FGOP)),
capyn(ti, get_escape(ti, ESCAPE_BGOP)));
ncplane_set_fg_rgb8(n, 0xc4, 0x5a, 0xec);
ncplane_printf(n, "%sbackground of 0x%06lx is %sconsidered transparent\n", indent, ti->bg_collides_default & 0xfffffful,
(ti->bg_collides_default & 0x01000000) ? "" : "not ");
ncplane_set_fg_default(n);
}
static void
tinfo_debug_styles(struct ncplane* n, const char* indent){
ncplane_set_fg_rgb8(n, 0xc8, 0xa2, 0xc8);
ncplane_putstr(n, indent);
tinfo_debug_style(n, "bold", NCSTYLE_BOLD);
ncplane_putchar(n, ' ');

View File

@ -1,3 +1,5 @@
#include "version.h"
#include "builddef.h"
#include <ncurses.h> // needed for some definitions, see terminfo(3ncurses)
#include <fcntl.h>
#include <errno.h>

View File

@ -1259,7 +1259,7 @@ int notcurses_stop(notcurses* nc){
// if we were not using the alternate screen, our cursor's wherever we last
// wrote. move it to the bottom left of the screen, *unless*
// NCOPTION_PRESERVE_CURSOR was used, in which case it's right where we
// want it (i think?).
// want it (i think? FIXME maybe next line's start?).
if(!(nc->flags & NCOPTION_PRESERVE_CURSOR)){
if(!get_escape(&nc->tcache, ESCAPE_SMCUP)){
// if ldimy is 0, we've not yet written anything; leave it untouched