diff --git a/common/gal/color4d.cpp b/common/gal/color4d.cpp
index 65ca86ff63..83038b2b5e 100644
--- a/common/gal/color4d.cpp
+++ b/common/gal/color4d.cpp
@@ -263,7 +263,7 @@ std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor )
 }
 
 
-void COLOR4D::ToHSV( double& aOutHue, double& aOutSaturation, double& aOutValue ) const
+void COLOR4D::ToHSV( double& aOutHue, double& aOutSaturation, double& aOutValue, bool aAlwaysDefineHue ) const
 {
     double min, max, delta;
 
@@ -283,7 +283,7 @@ void COLOR4D::ToHSV( double& aOutHue, double& aOutSaturation, double& aOutValue
     else    // for black color (r = g = b = 0 )  saturation is set to 0.
     {
         aOutSaturation = 0.0;
-        aOutHue = 0.0;
+        aOutHue = aAlwaysDefineHue ? 0.0 : NAN;
         return;
     }
 
@@ -309,8 +309,10 @@ void COLOR4D::ToHSV( double& aOutHue, double& aOutSaturation, double& aOutValue
         if( aOutHue < 0.0 )
             aOutHue += 360.0;
     }
-    else    // delta = 0 means r = g = b. hue is set to 0.0
-        aOutHue = 0.0;
+    else   // delta = 0 means r = g = b. hue is set to 0.0
+    {
+        aOutHue = aAlwaysDefineHue ? 0.0 : NAN;
+    }
 }
 
 
diff --git a/include/gal/color4d.h b/include/gal/color4d.h
index e5f827d078..3803d52f43 100644
--- a/include/gal/color4d.h
+++ b/include/gal/color4d.h
@@ -264,10 +264,13 @@ public:
      * @param aOutHue is the conversion result for hue component, in degrees 0 ... 360.0
      * @param aOutSaturation is the conversion result for saturation component (0 ... 1.0).
      * @param aOutValue is conversion result for value component (0 ... 1.0).
-     * @note saturation is set to 0.0 for black color (r = v = b = 0), and
-     * hue is set to 0.0 if r = v = b = 0.
+     * @param aAlwaysDefineHue controls the way hue is defined when r = v = b
+     * @note saturation is set to 0.0 for black color (r = v = b = 0), and if r = v = b,
+     * hue is set to 0.0 if aAlwaysDefineHue = true, and set to NAN if aAlwaysDefineHue = false.
+     * this option is usefull to convert a 4D color to a legacy color, because Red has hue = 0,
+     * therefore aAlwaysDefineHue = false makes difference between Red and Gray colors.
      */
-    void ToHSV( double& aOutHue, double& aOutSaturation, double& aOutValue ) const;
+    void ToHSV( double& aOutHue, double& aOutSaturation, double& aOutValue, bool aAlwaysDefineHue = false ) const;
 
     /**
      * Function FromHSV()