title: Mandelbrot-algorithm - Background color
body: <p>I'm writing a Mandelbrot app in C# (and I'm testing with Python). I already have the continous coloring from the set to its borders. My current problem is to set the background color of the environment. 
  My current code for getting the color now looks like this, it gets the color as double (the logarithm function is done before) and checks wether it's part or not and creates a quite smooth gradient (from black to orange). </p>
  
  <pre><code>    private Color getColor(double i)
      {
          double ratio = i / (double)(iterations);
          int col = (int)(i / iterations * 255);
          int alpha = 255;
  
          if (ratio &gt;= 0 &amp;&amp; ratio &lt; 0.25)
              return Color.FromArgb(alpha, col, col/5, 0);
  
          if (ratio &gt;= 0.25 &amp;&amp; ratio &lt; 0.50)
              return Color.FromArgb(alpha, col, col/4, 0);
  
          if (ratio &gt;= 0.50 &amp;&amp; ratio &lt; 0.75)
              return Color.FromArgb(alpha, col, col/3, 0);
  
          if (ratio &gt;= 0.75 &amp;&amp; ratio &lt; 1)
              return Color.FromArgb(alpha, col, col/2, 0);
  
          return Color.Black; //color of the set itself
      }
  </code></pre>
  
  <p>How can I change the black environement (not the Mandelbrot set) to another color like the obfuscated Python script (<a href="http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python" rel="nofollow">http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python</a>) does? I already edited the script to a nicer form, but it doesn't fit my algorithm. </p>
  
  <p>EDIT: Forgot to mention, I'm not using a class for the complex equotation, I compute the fractal with the algorithm that's shown on Wikipedia. </p>