Skip to content

Commit

Permalink
chore: make color selector usable with prefix ui (#5863)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Olszewski <Chris Olszewski>
  • Loading branch information
chris-olszewski committed Sep 2, 2023
1 parent e52f667 commit 492d2da
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/turborepo-ui/src/color_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
sync::{Arc, OnceLock, RwLock},
};

use console::Style;
use console::{Style, StyledObject};

static COLORS: OnceLock<[Style; 5]> = OnceLock::new();

Expand Down Expand Up @@ -49,13 +49,13 @@ impl ColorSelector {
color
}

pub fn prefix_with_color(&self, cache_key: &str, prefix: &str) -> Cow<'static, str> {
pub fn prefix_with_color(&self, cache_key: &str, prefix: &str) -> StyledObject<String> {
if prefix.is_empty() {
return "".into();
return Style::new().apply_to(String::new());
}

let style = self.color_for_key(cache_key);
style.apply_to(format!("{}: ", prefix)).to_string().into()
style.apply_to(format!("{}: ", prefix))
}
}

Expand Down

0 comments on commit 492d2da

Please sign in to comment.