title: C++ Color calculation from grayscape to color
body: <p>I have a program that generates an grayscale image. The grayshading for every pixel is set with the following code sniped:</p>
  
  <pre><code>//loop over all pixel
      *PixelColorPointer = Number * 0x010101;
  </code></pre>
  
  <p>in this case the <code>Number</code> is an integer number between 0 and 255. Which generates all grayscale colors from black to white. </p>
  
  <p>What I try to do is have an colored image (in order to have <a href="https://en.wikipedia.org/wiki/False_color" rel="nofollow noreferrer">false colors</a>), but I don't really understand the calculation with the hex value. I figured out if I assign e.g. <code>Number * 0xFFFFFF</code> I have a gradient/variety from white to yellow.</p>
  
  <p>Can someone explain me how the calculation of this colors is working? Please remember that (as said already) I want/have to pass the <code>Number</code> variable to get variety.</p>