-
Notifications
You must be signed in to change notification settings - Fork 689
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
Raise error for colors with leading # #869
Conversation
Nice! Thanks for the PR! First off please add an entry to the change log so we can doc the updated behavior. Also I'm not sure that checking for the length of the string will be enough, as someone could say pass when String
if color =~ /\A[0-F]{6}\z/i
:RGB
else
raise ArgumentError, "Unknown type of color: #{color.inspect}"
end Thanks again! |
Good call! I wasn't thinking about the actual string content, I'll update both of those |
I'm just going to close this because it's probably no longer valid |
Hey I missed that you updated this branch, if you are still interested in getting it in I'm open to merging. Thanks! |
f4fd788
to
cbf476b
Compare
@packetmonkey Thanks! Should be good to go now |
manual/graphics/color.rb
Outdated
@@ -10,7 +10,7 @@ | |||
Prawn::ManualBuilder::Example.generate(filename) do | |||
stroke_axis | |||
|
|||
# Fill with Yellow using RGB | |||
# Fill with Yellow using RGB (Unlink css, there is no leading #) |
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.
Unlike.
cbf476b
to
4858753
Compare
@@ -94,7 +94,11 @@ def process_color(*color) | |||
def color_type(color) | |||
case color | |||
when String | |||
:RGB | |||
if color =~ /\A[0-F]{6}\z/i |
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.
There are a few characters that we probably don't want to match between '9'
and 'A'
. I'd prefer this regex to be something more specific. For example /\A[0-9a-f]{6}\z/i
.
@tomprats If you're steal interested, please address my comment and rebase your branch on master. Thank you. |
3c5df3e
to
8309626
Compare
@tomprats Than you for your contribution. I've rebased this PR on master and merged. GitHub didn't pick it up so I will close it now. |
@pointlessone Thanks! Sorry I never got around to making the extra changes |
Saw this issue and thought I could help! Really appreciate all the work you guys do!