diff --git a/src/Magnum/Math/Color.h b/src/Magnum/Math/Color.h index ef01d0658..949438720 100644 --- a/src/Magnum/Math/Color.h +++ b/src/Magnum/Math/Color.h @@ -438,7 +438,7 @@ class Color4: public Vector4 { return Color4(Implementation::fromHSV(hsv), a); } /** @overload */ - constexpr static Color4 fromHSV(Deg hue, FloatingPointType saturation, FloatingPointType value, T alpha) { + constexpr static Color4 fromHSV(Deg hue, FloatingPointType saturation, FloatingPointType value, T alpha = Implementation::fullChannel()) { return fromHSV(std::make_tuple(hue, saturation, value), alpha); } diff --git a/src/Magnum/Math/Test/ColorTest.cpp b/src/Magnum/Math/Test/ColorTest.cpp index e7b7d3155..770602039 100644 --- a/src/Magnum/Math/Test/ColorTest.cpp +++ b/src/Magnum/Math/Test/ColorTest.cpp @@ -313,6 +313,10 @@ void ColorTest::hsvOverflow() { void ColorTest::hsvAlpha() { CORRADE_COMPARE(Color4ub::fromHSV(std::make_tuple(230.0_degf, 0.749f, 0.427f), 23), Color4ub(27, 40, 108, 23)); CORRADE_COMPARE(Color4ub::fromHSV(230.0_degf, 0.749f, 0.427f, 23), Color4ub(27, 40, 108, 23)); + + /* Default alpha */ + CORRADE_COMPARE(Color4ub::fromHSV(std::make_tuple(230.0_degf, 0.749f, 0.427f)), Color4ub(27, 40, 108, 255)); + CORRADE_COMPARE(Color4ub::fromHSV(230.0_degf, 0.749f, 0.427f), Color4ub(27, 40, 108, 255)); } void ColorTest::swizzleType() {