Skip to content

Commit

Permalink
Add grey to the list of Sass Script colors.
Browse files Browse the repository at this point in the history
Addresses #738
  • Loading branch information
Rob Wierzbowski authored and nex3 committed May 24, 2013
1 parent a4b3fa2 commit 54ea0d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions doc-src/SASS_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ Thanks to Alexander Pavlov for implementing this.
allows them the same power as Sass-based functions with respect to
reading and setting variables defined elsewhere in the stylesheet.

* Add "grey" as a recognized SassScript color. Thanks to [Rob
Wierzbowski](https://github.com/robwierzbowski).

### Backwards Incompatibilities -- Must Read!

* Sass will now throw an error when `@extend` is used to extend a selector
Expand All @@ -78,6 +81,9 @@ Thanks to Alexander Pavlov for implementing this.

* `Sass::Script::Number::PRECISION` has been removed.

* `grey` is no longer interpreted as a string; it's now interpreted as a color,
as per the CSS spec.

## 3.2.9

* Fix a bug where `@extend`s would occasionally cause a selector to be generated
Expand Down
5 changes: 3 additions & 2 deletions lib/sass/script/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class << self; include Sass::Util; end
'gold' => 0xffd700,
'goldenrod' => 0xdaa520,
'gray' => 0x808080,
'grey' => 0x808080,
'green' => 0x008000,
'greenyellow' => 0xadff2f,
'honeydew' => 0xf0fff0,
Expand Down Expand Up @@ -171,7 +172,7 @@ class << self; include Sass::Util; end

# Constructs an RGB or HSL color object,
# optionally with an alpha channel.
#
#
# The RGB values must be between 0 and 255.
# The saturation and lightness values must be between 0 and 100.
# The alpha value must be between 0 and 1.
Expand Down Expand Up @@ -526,7 +527,7 @@ def hex_str
def piecewise(other, operation)
other_num = other.is_a? Number
if other_num && !other.unitless?
raise Sass::SyntaxError.new("Cannot add a number with units (#{other}) to a color (#{self}).")
raise Sass::SyntaxError.new("Cannot add a number with units (#{other}) to a color (#{self}).")
end

result = []
Expand Down
4 changes: 2 additions & 2 deletions test/sass/functions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,8 @@ def test_mix_tests_bounds

def test_grayscale
assert_equal("#bbbbbb", evaluate("grayscale(#abc)"))
assert_equal("gray", evaluate("grayscale(#f00)"))
assert_equal("gray", evaluate("grayscale(#00f)"))
assert_equal("grey", evaluate("grayscale(#f00)"))
assert_equal("grey", evaluate("grayscale(#00f)"))
assert_equal("white", evaluate("grayscale(white)"))
assert_equal("black", evaluate("grayscale(black)"))
assert_equal("black", evaluate("grayscale($color: black)"))
Expand Down

0 comments on commit 54ea0d4

Please sign in to comment.