Document that themeing

This commit is contained in:
sholderbach 2024-08-04 23:31:24 +02:00
parent d8d4a96eed
commit 4ffdbf4d93

View File

@ -440,6 +440,11 @@ fn get_argument_for_color_value(
} }
} }
/// Contains the settings for ANSI colors in help output
///
/// By default contains a fixed set of (4-bit) colors
///
/// Can reflect configuration using [`HelpStyle::update_from_config`]
pub struct HelpStyle { pub struct HelpStyle {
section_name: String, section_name: String,
subcolor_one: String, subcolor_one: String,
@ -460,6 +465,13 @@ impl Default for HelpStyle {
} }
impl HelpStyle { impl HelpStyle {
/// Pull colors from the [`Config`]
///
/// Uses some arbitrary `shape_*` settings, assuming they are well visible in the terminal theme.
///
/// Implementation detail: currently executes `ansi` command internally thus requiring the
/// [`EngineState`] for execution.
/// See <https://github.com/nushell/nushell/pull/10623> for details
pub fn update_from_config(&mut self, engine_state: &EngineState, nu_config: &Config) { pub fn update_from_config(&mut self, engine_state: &EngineState, nu_config: &Config) {
update_ansi_from_config( update_ansi_from_config(
&mut self.section_name, &mut self.section_name,