-
Notifications
You must be signed in to change notification settings - Fork 37
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
Accept 8digit Hex color code #221
Conversation
i have corrected the code for alpha. please let me know if the change is right or wrong. |
src/p2/element.rs
Outdated
if v.starts_with("#") && v.len() == 9 { | ||
let (_, value_string) = string.split_at(1); | ||
|
||
let iv = u64::from_str_radix(value_string, 16).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can not call unwrap()
like this, as then the entire process will panic and die. If you can not parse something, let css_color_parser() parse it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or return an error like you have done few lines down.
@ADITIRAI290698 please fix the title of this PR. Also please try to add some tests for the feature and ensure tests are passing. Checkout interpreter.rs which has a lot of tests, you can add "integration test" there. You can also add add "unit test" in the same module where you have implemented the function. |
@ADITIRAI290698 also if you are creating a PR to fix an issue, mention the issue URL in the PR description so there is context. |
Remove the |
i will be converting alpha from hexa to deci.