Actually, in HSV, to lighten, reduce the saturation, raise the value.
To darken, raise the saturation, reduce the value.
That's one possible method.
There are many algorithms available on the internet.