Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add const methods to ColorSpec #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Property404
Copy link

Can now do

const RED: ColorSpec = ColorSpec::new().with_fg(Some(Color::Red));

instead of

let mut red = ColorSpec::new();
let red = red.set_fg(Some(Color::Red));

This is a convenience because:

  • A ColorSpec can be defined in a single line
  • A ColorSpec can be defined once and used in multiple scopes, without using statics or struct literal syntax

@dimo414
Copy link

dimo414 commented Oct 5, 2022

The .with_ methods in particular would be great additions, thanks!

@Property404 Property404 force-pushed the Property404/const-colorspec branch 2 times, most recently from 28f5e85 to 2d27132 Compare November 14, 2023 03:36
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