1notcurses_capabilities(3) notcurses_capabilities(3)
2
3
4
6 notcurses_capabilities - runtime capability detection
7
9 #include <notcurses/notcurses.h>
10
11 const char* notcurses_detected_terminal(const struct notcurses* nc);
12
13 unsigned notcurses_supported_styles(const struct notcurses* nc);
14
15 unsigned notcurses_palette_size(const struct notcurses* nc);
16
17 bool notcurses_cantruecolor(const struct notcurses* nc);
18
19 bool notcurses_canfade(const struct notcurses* nc);
20
21 bool notcurses_canchangecolor(const struct notcurses* nc);
22
23 bool notcurses_canopen_images(const struct notcurses* nc);
24
25 bool notcurses_canopen_videos(const struct notcurses* nc);
26
27 bool notcurses_canutf8(const struct notcurses* nc);
28
29 bool notcurses_canhalfblock(const struct notcurses* nc);
30
31 bool notcurses_canquadrant(const struct notcurses* nc);
32
33 bool notcurses_cansextant(const struct notcurses* nc);
34
35 bool notcurses_canbraille(const struct notcurses* nc);
36
37 bool notcurses_canpixel(const struct notcurses* nc);
38
39 typedef enum {
40 NCPIXEL_NONE = 0,
41 NCPIXEL_SIXEL, // sixel
42 NCPIXEL_LINUXFB, // linux framebuffer
43 NCPIXEL_ITERM2, // iTerm2
44 NCPIXEL_KITTY_STATIC, // kitty pre-0.20.0
45 NCPIXEL_KITTY_ANIMATED, // kitty pre-0.22.0
46 NCPIXEL_KITTY_SELFREF, // kitty 0.22.0+, wezterm
47 } ncpixelimpl_e;
48
49 ncpixelimpl_e notcurses_check_pixel_support(struct notcurses* nc);
50
52 notcurses_detected_terminal returns a free-form string describing the
53 detected terminal. Terminal detection takes into account any specified
54 terminal database (see notcurses_init(3)), the TERM, TERM_PROGRAM, and
55 TERM_PROGRAM_VERSION environment variables, the response to a
56 XTGETTCAP[TN] Device Control String, the response to Primary, Sec‐
57 ondary, and Tertiary Send Device Attributes control sequences, and the
58 phase of the moon. You should not build logic around this response;
59 all relevant properties of the terminal ought be abstracted by Notcurs‐
60 es. This is only made available for diagnostics.
61
62 notcurses_supported_styles returns a bitmask representing those styles
63 for which the terminal advertises support.
64
65 notcurses_palette_size returns the size of the terminal's palette, used
66 for palette-indexed color. It will always return at least 1. This is
67 independent of RGB TrueColor support. No terminal is know to support
68 more than 256-indexed color.
69
70 notcurses_cantruecolor returns true if the terminal advertises support
71 for RGB TrueColor. Note that the RGB APIs of Notcurses can be used
72 even in the absence of terminal RGB support (Notcurses will map the RGB
73 values to the palette).
74
75 notcurses_canfade returns true if Notcurses has a means by which it can
76 effect fades.
77
78 notcurses_canchangecolor returns true if the terminal advertises sup‐
79 port for changing its palette entries.
80
81 notcurses_canopen_images returns true if Notcurses was built with mul‐
82 timedia support.
83
84 notcurses_canopen_video returns true if Notcurses was built with multi‐
85 media support capable of decoding videos.
86
87 notcurses_canutf8 returns true if the configured locale uses UTF-8 en‐
88 coding, and the locale was successfully loaded.
89
90 notcurses_cansextant returns true if the heuristics suggest that the
91 terminal can properly render Unicode 13 sextants. Likewise, notcurs‐
92 es_canquadrant and notcurses_canhalfblock return true if the heuristics
93 suggest that the terminal can properly render Unicode quadrants and
94 halfblocks, respectively. notcurses_canbraille returns true if Unicode
95 Braille is expected to work on the terminal. None of these functions
96 return true unless UTF-8 encoding is in use.
97
98 notcurses_check_pixel_support returns a non-zero pixel implementation
99 if bitmap support (via any mechanism) has been detected, and otherwise
100 0 (NCPIXEL_NONE). notcurses_canpixel folds this down to a boolean.
101
103 Some terminals advertise support for TrueColor, but then downsample or
104 otherwise degrade the provided RGB. In this case notcurses_cantruecol‐
105 or will return true, but the full spectrum will not be available.
106
108 notcurses(3), notcurses_init(3), notcurses_visual(3), utf8(7)
109
111 nick black <nickblack@linux.com>.
112
113
114
115 v3.0.8 notcurses_capabilities(3)