your hex to hsl values are not correct for current IM syntax (since 6.5.6.6). see the colorconverter at
http://www.imagemagick.org/script/color.php
#31cd84 --> hsl(151.92,156.61,127)
#31969a --> hsl(182.29,131.89,101.5)
try this for integer values of hsl:
convert -size 100x100 xc:"hsl(152,157,127)" hsl1.png
convert -size 100x100 xc:"hsl(182,132,102)" hsl2.png
L=`convert xc: -format "%[fx:100+100*(102-127)/127]" info:`
S=`convert xc: -format "%[fx:100+100*(132-157)/157]" info:`
H=`convert xc: -format "%[fx:100+200*(182-152)/360]" info:`
echo "L=$L, S=$S, H=$H"
convert hsl1.png -modulate $L,$S,$H hsl1to2.png
or for the exact hsl values that match your hex values, try this
convert -size 100x100 xc:"hsl(151.92,156.61,127)" hsl1.png
convert -size 100x100 xc:"hsl(182.29,131.89,101.5)" hsl2.png
L=`convert xc: -format "%[fx:100+100*(101.5-127)/127]" info:`
S=`convert xc: -format "%[fx:100+100*(131.89-156.61)/156.61]" info:`
H=`convert xc: -format "%[fx:100+200*(182.29-151.92)/360]" info:`
echo "L=$L, S=$S, H=$H"
convert hsl1.png -modulate $L,$S,$H hsl1to2.png
The above is unix, so if on windows, see
http://www.imagemagick.org/Usage/windows/ for syntax differences
P.S. The technique/formulae seem to work for other colors:
#fedcba to #abcdef
convert -size 100x100 xc:"hsl(30,247.72,220)" hsl1.png
convert -size 100x100 xc:"hsl(210,173.4,205)" hsl2.png
L=`convert xc: -format "%[fx:100+100*(205-220)/220]" info:`
S=`convert xc: -format "%[fx:100+100*(173.4-247.72)/247.72]" info:`
H=`convert xc: -format "%[fx:100+200*(210-30)/360]" info:`
echo "L=$L, S=$S, H=$H"
convert hsl1.png -modulate $L,$S,$H hsl1to2.png