Arkanjo 0.1
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
UtilsOSDependable Namespace Reference

Functions

float get_terminal_bg_color_luminance ()
 Gets the luminance of terminal background color.
 
tuple< int, int, int > parse_terminal_color_response (const string &response)
 Parses terminal color response into RGB components.
 
string capture_terminal_response ()
 Captures terminal response to color query.
 
bool is_bg_color_dark ()
 Determines if terminal background color is dark.
 
int convert_16_bit_to_8_bit (const string &hex16)
 Converts a 16-bit hex color string to 8-bit RGB components.
 
tuple< int, int, int > parse_terminal_color_response ()
 Parses terminal color response into RGB components on Windows.
 

Function Documentation

◆ capture_terminal_response()

string UtilsOSDependable::capture_terminal_response ( )

Captures terminal response to color query.

Returns
string Raw terminal response containing color information
Note
Uses low-level terminal I/O to capture the response

Definition at line 40 of file linux_utils.cpp.

◆ convert_16_bit_to_8_bit()

int UtilsOSDependable::convert_16_bit_to_8_bit ( const string & hex16)

Converts a 16-bit hex color string to 8-bit RGB components.

Parameters
hex1616-bit hex color string (format: "RRGGBB" or "#RRGGBB")
Returns
int 8-bit color value (0-255)
Note
Input string can be with or without leading '#'

◆ get_terminal_bg_color_luminance()

float UtilsOSDependable::get_terminal_bg_color_luminance ( )

Gets the luminance of terminal background color.

Gets the luminance of terminal background color on Windows.

Returns
float Luminance value between 0 (dark) and 1 (light)
Note
Uses terminal escape sequences to query background color
Returns
float Luminance value between 0 (dark) and 1 (light)
Note
Uses Windows Console API to determine background color
Defaults to dark if unable to determine color

Definition at line 77 of file linux_utils.cpp.

◆ is_bg_color_dark()

bool UtilsOSDependable::is_bg_color_dark ( )

Determines if terminal background color is dark.

Determines if terminal background color is dark on Windows.

Returns
bool True if background is dark (luminance < 0.5), false otherwise
Note
Uses get_terminal_bg_color_luminance() internally
Returns
bool True if background is dark (luminance < 0.5), false otherwise
Note
Uses get_terminal_bg_color_luminance() internally
Defaults to true (dark) if unable to determine color

Definition at line 89 of file linux_utils.cpp.

◆ parse_terminal_color_response() [1/2]

tuple< int, int, int > UtilsOSDependable::parse_terminal_color_response ( )

Parses terminal color response into RGB components on Windows.

Returns
tuple<int, int, int> RGB components as 8-bit values (0-255)
Note
Uses Windows Console API to get color information
Returns default dark theme colors if unable to determine

◆ parse_terminal_color_response() [2/2]

tuple< int, int, int > UtilsOSDependable::parse_terminal_color_response ( const string & response)

Parses terminal color response into RGB components.

Parameters
responseTerminal color response string (format: "rgb:RRRR/GGGG/BBBB")
Returns
tuple<int, int, int> RGB components as 16-bit values (0-65535)
Exceptions
Maythrow runtime_error for malformed input

Definition at line 14 of file linux_utils.cpp.