title: Finding Hue of Colour using Python?
body: <p>If you had a form where you in put hex colour codes </p>
  
  <pre><code>FFFFFF
  </code></pre>
  
  <p>how would you determine their hue? Like Cyan, Orange, etc...?</p>
  
  <p>So if someone typed in </p>
  
  <pre><code>#FF8000
  </code></pre>
  
  <p>The hue would be printed on the page saying Orange. </p>
  
  <p>If possible, could you also explain how this works? Or link me to something that explains it? </p>
  
  <p>Would it be plausible to enter this code inside of my main python script to be able to convert to HSV?</p>
  
  <pre><code>        #RGB to HSV start
      ONE_THIRD = 1.0/3.0
      ONE_SIXTH = 1.0/6.0
      TWO_THIRD = 2.0/3.0
      def rgb_to_hsv(r, g, b):
          maxc = max(r, g, b)
          minc = min(r, g, b)
          v = maxc
          if minc == maxc:
              return 0.0, 0.0, v
              s = (maxc-minc) / maxc
              rc = (maxc-r) / (maxc-minc)
              gc = (maxc-g) / (maxc-minc)
              bc = (maxc-b) / (maxc-minc)
          if r == maxc:
              h = bc-gc
          elif g == maxc:
              h = 2.0+rc-bc
          else:
              h = 4.0+gc-rc
              h = (h/6.0) % 1.0
              return h, s, v
  
      #RGB to HSV end
  </code></pre>