feat(lib): make it possible to use as a lib #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'd like to be able to be able to use the colors from this crate in Ratatui apps, and document it from our website (Issue ratatui/ratatui-website#318).
I think ratatui / crossterm should generally be optional deps for a lib (so this lib can be used by non-ratatui apps without including extraneous deps), but there isn't a good way yet to only have optional deps for the lib (rust-lang/cargo#1982). The other alternative to this PR would be to split this into two separate crates, one for the cli and one for the lib, but the crate name
material
makes a really good import name. The downside is that installation now needs a--features=cli
to enable the right features. I think this is a reasonable tradeoff.Docs for the
colors
module render with little squares for the colors:Added
--locked
to the install command in order to avoid installing different versions than are specified in the cargo.lock file. This is generally good practice for apps to avoid breaking users when new versions of libs are released.