Skip to content

Commit 697216f

Browse files
committed
Match Ruby Sass' colour rounding logic for %'age values
1 parent eadae5b commit 697216f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/functions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ namespace Sass {
234234

235235
inline double color_num(Number* n) {
236236
if (n->unit() == "%") {
237-
return std::min(std::max(n->value(), 0.0), 100.0) * 2.55;
237+
return std::min(std::max(n->value() * 255 / 100.0, 0.0), 255.0);
238238
} else {
239239
return std::min(std::max(n->value(), 0.0), 255.0);
240240
}

0 commit comments

Comments
 (0)