This might do what you want (uses javaobject library in UI application)
B4X:
…
Dim hsb(3) As Float = RGBtoHSB(200,170,75) ' r g b values
Log("(H)ue : "&hsb(0))
Log("(S)aturation % : "&hsb(1))
Log("(B)rightness % : "&hsb(2))
End Sub
Sub RGBtoHSB(red As Int,green As Int,blue As Int) As Float()
Dim HSB(3) As Float
Dim p As JavaObject = fx.Colors.RGB(red,green,blue)
HSB(0)=p.RunMethod("getHue",Null) ' degree value
HSB(1)=p.RunMethod("getSaturation",Null)*100 ' to percentile value
HSB(2)=p.RunMethod("getBrightness",Null)*100 ' to percentile value
Return HSB
End Sub