Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
env.cpp File Reference

Terminal color and UTF-8 support detection, and COLUMN parsing from environment variables. More...

#include "sham/term/env.hpp"
#include "sham/term/color.hpp"
#include "sham/term/tty.hpp"
#include <string_view>
#include <cctype>
#include <vector>
Include dependency graph for env.cpp:

Go to the source code of this file.

Namespaces

namespace  sham
 namespace for backends this one is named only sham since shambackends is too long to write

Functions

ColorLevel sham::term::detect_color_level (TermEnvVars vars)
 Detect the terminal emulator's color support level from TERM/COLORTERM.
void sham::term::parse_terminal_support (TermEnvVars vars, const term_parse_callback_t &error_callback)
 Parses terminal environment variables to determine color support and set terminal size.

Detailed Description

Terminal color and UTF-8 support detection, and COLUMN parsing from environment variables.

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file env.cpp.

Function Documentation

◆ detect_color_level()

ColorLevel sham::term::detect_color_level ( TermEnvVars vars)

Detect the terminal emulator's color support level from TERM/COLORTERM.

COLORTERM=truecolor/24bit returns ColorLevel::TrueColor.

Returns
the detected color support level

Definition at line 103 of file env.cpp.

◆ parse_terminal_support()

void sham::term::parse_terminal_support ( TermEnvVars vars,
const term_parse_callback_t & error_callback )

Parses terminal environment variables to determine color support and set terminal size.

Definition at line 132 of file env.cpp.