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

Environment variable parsing for terminal color, size and UTF-8 support configuration (TERM, COLORTERM, NO_COLOR, CLICOLOR_FORCE, COLUMN, LANG, LC_ALL, LC_CTYPE, NO_UTF8, FORCE_UTF8). More...

#include "sham/term/color.hpp"
#include "sham/term/error_callback.hpp"
#include <string_view>
#include <optional>
Include dependency graph for env.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sham::term::TermEnvVars
 Holds optional terminal environment variables (TERM, COLORTERM, NO_COLOR, CLICOLOR_FORCE, COLUMN, LANG, LC_ALL, LC_CTYPE, NO_UTF8, FORCE_UTF8). More...

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

Environment variable parsing for terminal color, size and UTF-8 support configuration (TERM, COLORTERM, NO_COLOR, CLICOLOR_FORCE, COLUMN, LANG, LC_ALL, LC_CTYPE, NO_UTF8, FORCE_UTF8).

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.hpp.

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.