Created
January 26, 2009 07:03
-
-
Save rmorlang/52732 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The bug below has been fixed in color 1.4 which is | |
# the successor to color-tools 1.3.0 | |
# | |
# There's a bug in color-tools when converting HSL to RGB for desaturated | |
# colors. It doesn't multiple the lightness value by 255, so every resulting | |
# set of RGB values ends up being (1,1,1). This monkeypatch fixes it. | |
class Color::HSL | |
def to_rgb_with_saturation_bugfix(ignored = nil) | |
return Color::RGB.new(*([@l * 0xff] * 3)) if @s <= 1e-5 | |
to_rgb_without_saturation_bugfix(ignored) | |
end | |
alias :to_rgb_without_saturation_bugfix :to_rgb | |
alias :to_rgb :to_rgb_with_saturation_bugfix | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment