78. convert HEX color to RGBA

medium  - accepted / - tried

Suppose you write some CSS code, you need to set colors. You can choose hexadecimal notation #fff or Functional notation rgba(255,255,255,1).

Can you write a function to convert hexadecimal notation to functional notation?

// 'rgba(255,255,255,1)'
  1. Alpha channel should have maximum 2 digits after decimal point, round up if needed.
  2. Don't forget to do input validation

Always try to find a better approach.