summaryrefslogtreecommitdiff
path: root/src/csscolorparser/csscolorparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/csscolorparser/csscolorparser.cpp')
-rw-r--r--src/csscolorparser/csscolorparser.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/csscolorparser/csscolorparser.cpp b/src/csscolorparser/csscolorparser.cpp
index 4d1c6a3d65..106dae6cef 100644
--- a/src/csscolorparser/csscolorparser.cpp
+++ b/src/csscolorparser/csscolorparser.cpp
@@ -185,7 +185,6 @@ optional<Color> parse(const std::string& css_str) {
// Convert to lowercase.
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
-
for (const auto& namedColor : namedColors) {
if (str == namedColor.name) {
return { namedColor.color };
@@ -262,8 +261,9 @@ optional<Color> parse(const std::string& css_str) {
}
float h = parseFloat(params[0]) / 360.0f;
- while (h < 0.0f) h++;
- while (h > 1.0f) h--;
+ float i;
+ // Normalize the hue to [0..1[
+ h = std::modf(h, &i);
// NOTE(deanm): According to the CSS spec s/l should only be
// percentages, but we don't bother and let float or percentage.