pub struct TerminalCapabilities {
pub color_support: ColorSupport,
pub bracketed_paste: bool,
pub mouse: bool,
pub cursor_style: bool,
}Expand description
Terminal capabilities that influence how MinUI should render.
Fields§
§color_support: ColorSupportColor fidelity supported by the terminal.
bracketed_paste: boolWhether bracketed paste mode is expected to work.
Note: MinUI enables bracketed paste when initializing TerminalWindow.
This flag is purely informational for apps that want to display/adjust UI.
mouse: boolWhether mouse capture/reporting is expected to work.
Note: MinUI enables mouse capture when initializing TerminalWindow.
This flag is informational, as terminals can still vary.
cursor_style: boolWhether changing the cursor style (block/bar/underline) is likely supported.
MinUI does not currently expose cursor styling as a stable public API.
Implementations§
Source§impl TerminalCapabilities
impl TerminalCapabilities
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Best-effort autodetection using environment variables.
This intentionally avoids heavy dependencies and terminfo parsing.
Heuristics:
COLORTERM=truecolororCOLORTERM=24bit=> TruecolorTERMcontains-truecolor=> TruecolorTERMcontains256color=> Ansi256- otherwise => Ansi16
Notes:
- Many terminals do support truecolor even when
TERMdoesn’t advertise it. - Remote shells and tmux/screen can mask capabilities unless configured.
Sourcepub fn downgrade_pair(self, pair: ColorPair) -> ColorPair
pub fn downgrade_pair(self, pair: ColorPair) -> ColorPair
Returns a copy of pair with colors downgraded to this terminal’s capabilities.
This is the main “policy hook” for MinUI rendering: widgets/apps can request rich colors, and MinUI will degrade to what the terminal can likely display.
Sourcepub fn downgrade_color(self, c: Color) -> Color
pub fn downgrade_color(self, c: Color) -> Color
Downgrade a single Color to match self.color_support.
Rules:
Reset/Transparentare preserved- Named ANSI colors are preserved
AnsiValue(n)is preserved unless target isAnsi16(then approximated)Rgb{..}is preserved only forTruecolor; otherwise approximated
Trait Implementations§
Source§impl Clone for TerminalCapabilities
impl Clone for TerminalCapabilities
Source§fn clone(&self) -> TerminalCapabilities
fn clone(&self) -> TerminalCapabilities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TerminalCapabilities
Source§impl Debug for TerminalCapabilities
impl Debug for TerminalCapabilities
Source§impl Default for TerminalCapabilities
impl Default for TerminalCapabilities
impl Eq for TerminalCapabilities
Source§impl PartialEq for TerminalCapabilities
impl PartialEq for TerminalCapabilities
Source§fn eq(&self, other: &TerminalCapabilities) -> bool
fn eq(&self, other: &TerminalCapabilities) -> bool
self and other values to be equal, and is used by ==.