Skip to content

Use owo-colors instead of colored#5029

Closed
onx2 wants to merge 2 commits into
clockworklabs:masterfrom
onx2:chore/use-owo-colors
Closed

Use owo-colors instead of colored#5029
onx2 wants to merge 2 commits into
clockworklabs:masterfrom
onx2:chore/use-owo-colors

Conversation

@onx2
Copy link
Copy Markdown
Contributor

@onx2 onx2 commented May 15, 2026

Description of Changes

Replaces direct usage of colored with owo-colors in the CLI and update crates.

owo-colors provides similar styling ergonomics while avoiding colored's lazy_static dependency. It is also zero-allocation for common styling operations, so slightly faster, and has a smaller implementation footprint.

API and ABI breaking changes

None.

Expected complexity level and risk

1

This is a small dependency and import replacement for terminal styling in CLI-facing output.

Testing

  • cargo check -p spacetimedb-cli -p spacetimedb-update
  • Check output in terminal respect color for a command
  • Reviewer: verify work
image


loop {
let readline = rl.readline(&format!("🪐{}>", &database).green());
let readline = rl.readline(&format!("🪐{}>", &database).green().to_string());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macros like format and println are ok with anything that impl Display but this readline needs a &str so we need to first call to_string to convert unlike before which was automatically alloc a string for us.

@bfops
Copy link
Copy Markdown
Collaborator

bfops commented May 20, 2026

See the comment here: #5028 (comment)

@bfops bfops closed this May 20, 2026
@onx2
Copy link
Copy Markdown
Contributor Author

onx2 commented May 20, 2026

See the comment here: #5028 (comment)

Understood, I appreciate the review. Just to clarify for future reference, is the policy generally to avoid swapping out working deps for std lib or more optimized alternatives (e.g., zero-allocation, fewer dependencies, etc) to avoid code churn? I respect that, just want to make sure I know what to focus on next time. Thanks!

@onx2 onx2 deleted the chore/use-owo-colors branch May 20, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants