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

impl de trait for deserial ansi value and rgb #576

Merged
merged 2 commits into from
Jul 1, 2021
Merged

impl de trait for deserial ansi value and rgb #576

merged 2 commits into from
Jul 1, 2021

Conversation

zwpaper
Copy link
Contributor

@zwpaper zwpaper commented Jun 18, 2021

deserial json like:

{
    "color_example": "white",
    "ansi_value_example": 255,
     "rgb_example": [255, 255, 255]
}

@zwpaper
Copy link
Contributor Author

zwpaper commented Jun 22, 2021

Hi @TimonPost , crossterm color use the default deserial implementation, it can not deserial AnsiValue and Rgb, so that I try to implement the deserialization trait to make it support this format:

{
    "color_example": "white",
    "ansi_value_example": 255,
     "rgb_example": [255, 255, 255]
}

could you please review this when free

Copy link
Member

@TimonPost TimonPost left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. It would make sense to merge this into crossterm. Just to be sure I understand it right, this works for all kinds of serde crates?

There is some duplicated test.

src/style/types/color.rs Show resolved Hide resolved
@zwpaper
Copy link
Contributor Author

zwpaper commented Jul 1, 2021

Hi @TimonPost, yes, it should work for all kinds of serde crates, or it would be a bug.

besides the serde_json in tests, I would use serde_yaml in another project, It could be a validation for that.

@TimonPost TimonPost merged commit c983000 into crossterm-rs:master Jul 1, 2021
@TimonPost
Copy link
Member

Thanks for the contribution! Its good like this

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