Wolfram Language (Mathematica), 6363 48 bytes
StringJoin@@{"#",IntegerString[Round[15{##}]&@@RGBColor@#,16]}&"#"<>Round[15List@@RGBColor@#]~IntegerString~16& -15 bytes thanks to attinat! Replacing StringJoin with <> and compressing the syntax.
RGBColor@#converts the input string to a color of the formRGBColor[r, g, b]with three floating-point arguments in the range 0..1.Round[15 {##}] &List @@ %%]multiplies thesethe list of three arguments by 15 and rounds them to the nearest integer. We now have a list of three integer values corresponding to the three desired hexadecimal digits.IntegerString[%, 16]%~IntegerString~16converts this list of three integers to a list of three hexadecimal strings of one character each.StringJoin @@ {"#", %}"#"<>%prepends a#character and joins all these characters together.