Skip to content
You are viewing documentation for v7.0.1. Switch to latest (main).

Module ftxui/screen ​

Classes & Structs ​

ClassDescription
ftxui::BoxBox is a structure that represents a rectangular area in a 2D space.
ftxui::CellA Unicode character and its associated style.
ftxui::ColorColor is a class that represents a color in the terminal user interface.
ftxui::ColorInfoColorInfo is a structure that contains information about the terminal color palette.
ftxui::DimensionsDimensions is a structure that represents the size of the terminal.
ftxui::ScreenA rectangular grid of Cell.
ftxui::Screen::Cursor
ftxui::SurfaceA rectangular grid of Cell.
ftxui::Terminal::QuirksQuirks is a structure that represents various terminal-specific behaviors that may require fallbacks.
ftxui::Terminal::TerminalInfoTerminalInfo is a structure that contains information about the terminal.

Enumerations ​

Color ​

cpp
enum Color { Palette1, Palette16, Palette256, TrueColor };

Color is an enumeration that represents the color support of the terminal.

Examples: component/button_animated, component/button_in_frame, component/button_style, component/canvas_animated, component/dropdown_custom, component/flexbox_gallery, component/focus, component/homescreen, component/input_style, component/linear_gradient_gallery, component/maybe, component/menu_entries (+21 more)

Type Aliases ​

Image ​

cpp
using Image = Surface;

Pixel ​

cpp
using Pixel = Cell;

Functions ​

SymbolDescription
ColorInfoSorted2DGet the color information for the palette256, sorted in 2D.
operator""_rgbCreates a color from a combined hex RGB representation, e.g. 0x808000_rgb.
ColorSupportGet the color support of the terminal.
ComputeColorSupportCompute the color support based on environment variables and terminal identification.
GetQuirksGet the terminal quirks.
SetColorSupportOverride terminal color support in case auto-detection fails.
SetFallbackSizeOverride terminal size in case auto-detection fails.
SetQuirksOverride terminal quirks.
SizeGet the terminal size.
to_stringConvert a std::wstring into a UTF8 std::string.
to_wstringConvert a UTF8 std::string into a std::wstring.

ColorInfoSorted2D ​

cpp
std::vector< std::vector< ColorInfo > > ColorInfoSorted2D();

Get the color information for the palette256, sorted in 2D.

Returns: A 2D vector of ColorInfo.

Examples: component/homescreen, dom/color_gallery, dom/color_info_palette256

operator""_rgb ​

cpp
Color operator""_rgb(unsigned long long int combined);

Creates a color from a combined hex RGB representation, e.g. 0x808000_rgb.

ColorSupport ​

Get the color support of the terminal.

Examples: component/terminal_info, dom/color_gallery

ComputeColorSupport ​

cpp
Color ComputeColorSupport(std::string_view term, std::string_view colorterm, std::string_view term_program, std::string_view terminal_name, std::string_view terminal_emulator_name, const std::vector< int > & capabilities);

Compute the color support based on environment variables and terminal identification.

Parameters:

  • term: The TERM environment variable.
  • colorterm: The COLORTERM environment variable.
  • term_program: The TERM_PROGRAM environment variable.
  • terminal_name: The terminal name (from DA2).
  • terminal_emulator_name: The terminal emulator name (from XTVERSION).
  • capabilities: The terminal capabilities (from DA1).

GetQuirks ​

Get the terminal quirks.

Examples: component/terminal_info

SetColorSupport ​

Override terminal color support in case auto-detection fails.

Examples: component/terminal_info

SetFallbackSize ​

cpp
void SetFallbackSize(const Dimensions & fallbackSize);

Override terminal size in case auto-detection fails.

Parameters:

  • fallbackSize: Terminal dimensions to fallback to

SetQuirks ​

cpp
void SetQuirks(const Quirks & quirks);

Override terminal quirks.

Examples: component/terminal_info

Size ​

Get the terminal size.

Returns: The terminal size.

Examples: component/homescreen

to_string ​

cpp
std::string to_string(std::wstring_view s);

Convert a std::wstring into a UTF8 std::string.

Examples: component/button, component/button_animated, component/button_in_frame, component/button_style, component/checkbox_in_frame, component/composition, component/custom_loop, component/flexbox_gallery, component/focus, component/homescreen, component/input_in_frame, component/linear_gradient_gallery (+22 more)

to_wstring ​

cpp
std::wstring to_wstring(std::string_view s);

Convert a UTF8 std::string into a std::wstring.