#Japt, 35 32 22 20 16 15 bytes
Japt, 35 32 22 20 16 15 bytes
¡Y?(F-XnG)sG :X
Explanation:
¡ //Take input and map (shortcut to "Um@"). Input should in the form of "#123456"
Y? //if Y is not 0, then return (F-XnG)sG, otherwise last step...
F-XnG //Subtract X, converted from hexadecimal (G is 16) to decimal, from 15
sG //convert decimal to hexadecimal
:X //...otherwise return X unchanged (happens only with #, the first char)