From 0ec87939d230a73107c676115e359f8eeb9d783e Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 4 Jan 2016 23:49:12 -0800 Subject: [PATCH] Add toGrayscale --- include/CColor.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/CColor.hpp b/include/CColor.hpp index bbfd051..cbbc4ee 100644 --- a/include/CColor.hpp +++ b/include/CColor.hpp @@ -294,6 +294,9 @@ public: void fromHSL(float h, float s, float l, float _a = 1.0); void toHSL(float& h, float& s, float& l); + + CColor toGrayscale() + { return {Math::sqrtF(magSquared() / 3)}; } }; static inline CColor operator+(float lhs, const CColor& rhs)