-
Notifications
You must be signed in to change notification settings - Fork 42
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 Support for Multiple Color Formats in Room Class #306
Add Support for Multiple Color Formats in Room Class #306
Conversation
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.
Great start! Besides my inline comments:
- This all needs to work for things besides rooms, such as locations, hallways, objects, and robots.
- The YAML loading/saving utilities need to also support serializing and deserializing these color names and hex codes to/from strings.
I'm okay if item 1 is reserved to follow-on PRs if you'd like to split it up, but 2 needs to be done and tested at least for the rooms case.
I'm also okay if no matter how a user specifies colors in code/YAML, they always serialize to a consistent RGB format in the to_yaml()
methods. Probably easiest that way.
9859a4c
to
7de16d5
Compare
Point 1 : Yes, I am planning to do follow-on PRs for rest of things. Regarding point 2, I tested the support for multiple color formats for Room object by modifying room args in |
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.
Gave it a closer look, and just a few more comments on consistency.
Agree that things should just work with the YAML loading/saving tools since parse_color()
is very well factored out 👍🏻
- Update the docstring to include `string` as an alternative type. - Change return type of `parse_color` from `list` to `tuple`. - Update test cases to reflect modified return type
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.
Thank you!
This update allows the
Room
class to accept the color parameter in multiple formats:[R, G, B]
"red"
,"blue"
)"#0000FF"
)Unit tests have been added to verify the functionality.