title: How to check if a variable is a valid hex color in bash
body: <p>I need to have ha validity test to see if input from a user is valid. I need to know if the user writes a valid hex color.</p>
  
  <p>Input could be "FFTTAA" which would not be valid as TT is not hex. It then need to abort so it is not written to the file. My problem is that i do not know how to single out hex as it is both letters and numbers. Which means a simple [0-9] would not work.</p>
  
  <pre><code>read -p "Use light, normal or bold (ex. light): " ANS1; read -p "Write size in mm (ex. 1.8): " ANS2; read -p "Write color in hexadecimal (ex. FFFFFF): " ANS3;
  
  sed -i '/SwipeLauncherButtonStyle {/,/text/c\
      SwipeLauncherButtonStyle {\
      font: \$FONT_FAMILY '"$ANS1"' '"$ANS2"'mm;\
      text-color: \#'"$ANS3"';' file.css
  </code></pre>