how to solve relative color

Mastering Color Conversion: A Simple RGB to Hex Converter