Skip to content

Commit

Permalink
Add builder methods for the prompt colors
Browse files Browse the repository at this point in the history
  • Loading branch information
adaschma committed Jul 7, 2024
1 parent b8150e2 commit f1411cf
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,34 @@ impl Reedline {
self
}

/// A builder which sets the color to use for the prompt.
#[must_use]
pub fn with_prompt_color(mut self, color: Color) -> Self {
self.theme.prompt = color;
self
}

/// A builder which sets the color to use for the multiline prompt.
#[must_use]
pub fn with_prompt_multiline_color(mut self, color: nu_ansi_term::Color) -> Self {
self.theme.prompt_multiline = color;
self
}

/// A builder which sets the indicator color to use for the prompt.
#[must_use]
pub fn with_indicator_color(mut self, color: Color) -> Self {
self.theme.indicator = color;
self

Check warning on line 407 in src/engine.rs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest, stable, bashisms)

Diff in /home/runner/work/reedline/reedline/src/engine.rs

Check warning on line 407 in src/engine.rs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest, stable, default)

Diff in /home/runner/work/reedline/reedline/src/engine.rs

Check warning on line 407 in src/engine.rs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest, stable, sqlite)

Diff in /home/runner/work/reedline/reedline/src/engine.rs

Check warning on line 407 in src/engine.rs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest, stable, basqlite)

Diff in /home/runner/work/reedline/reedline/src/engine.rs

Check warning on line 407 in src/engine.rs

View workflow job for this annotation

GitHub Actions / build-lint-test (ubuntu-latest, stable, external_printer)

Diff in /home/runner/work/reedline/reedline/src/engine.rs
}


/// A builder which sets the color to use for the right side of the prompt.
#[must_use]
pub fn with_prompt_right_color(mut self, color: Color) -> Self {
self.theme.prompt_right = color;
self
}
/// Update current working directory.
#[must_use]
pub fn with_cwd(mut self, cwd: Option<String>) -> Self {
Expand Down

0 comments on commit f1411cf

Please sign in to comment.