mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
feat: Add the ability to configure per-module color styles (#285)
Add parsing logic, config support, docs, and integration with other modules for custom styling of each module.
This commit is contained in:
+4
-2
@@ -22,10 +22,12 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||
match get_ruby_version() {
|
||||
Some(ruby_version) => {
|
||||
const RUBY_CHAR: &str = "💎 ";
|
||||
let module_color = Color::Red.bold();
|
||||
|
||||
let mut module = context.new_module("ruby")?;
|
||||
module.set_style(module_color);
|
||||
let module_style = module
|
||||
.config_value_style("style")
|
||||
.unwrap_or_else(|| Color::Red.bold());
|
||||
module.set_style(module_style);
|
||||
|
||||
let formatted_version = format_ruby_version(&ruby_version)?;
|
||||
module.new_segment("symbol", RUBY_CHAR);
|
||||
|
||||
Reference in New Issue
Block a user