notcurses/doc/man/man3/notcurses_directmode.3.md
nick black 1fd0563093
Direct mode with its own type #77
Introduce the new type 'ncdirect', a stripped-down 'notcurses'
suitable for inline modification of regular output. Used the new
type because otherwise there were going to be if(directmode) checks
everywhere. Direct mode encompasses only colorizing and styling.
Add new man page notcurses_directmode(3). Add new section to README.
Add new PoC using direct mode RGB. Update demo table summary to use
direct mode.
2020-01-25 01:13:04 -05:00

46 lines
1.6 KiB
Markdown

% notcurses_directmode(3)
% nick black <nickblack@linux.com>
% v1.1.0
# NAME
notcurses_directmode - minimal notcurses instances for styling text
# SYNOPSIS
**#include <notcurses.h>**
**struct ncdirect* notcurses_directmode(const char *termtype, FILE* fp);**
**int ncdirect_stop(struct ncdirect* nc);**
**int term_bg_rgb8(struct ncdirect* nc, unsigned r, unsigned g, unsigned b);**
**int term_fg_rgb8(struct ncdirect* nc, unsigned r, unsigned g, unsigned b);**
# DESCRIPTION
**notcurses_directmode** prepares the **FILE** provided as **fp** (which must
be attached to a terminal) for colorizing and styling. On success, a pointer to
a valid **struct ncdirect** is returned. **NULL** is returned on failure.
Before the process exits, **ncdirect_stop(3)** should be called to reset the
terminal and free up resources.
An appropriate **terminfo(5)** entry must exist for the terminal. This entry is
usually selected using the value of the **TERM** environment variable (see
**getenv(3)**), but a non-**NULL** value for **termtype** will override this. An
invalid terminfo specification can lead to reduced performance, reduced
display capabilities, and/or display errors. notcurses natively targets
24bpp/8bpc RGB color, and it is thus desirable to use a terminal with the
**rgb** capability (e.g. xterm's **xterm-direct**).
# RETURN VALUES
**notcurses_directmode** returns **NULL** on failure. Otherwise, the return
value points to a valid **struct ncdirect**, which can be used until it is
provided to **ncdirect_stop**.
# SEE ALSO
**getenv(3)**, **termios(3)**, **notcurses(3)**, **terminfo(5)**