#Excel VBA, 251 246 224224 223 bytes
Saved 5 bytes thanks to ceilingcat
Saved 2223 bytes thanks to Taylor Scott
Sub m
D=99
For x=1To 4*D
For y=1To 4*D
p=0
q=0
For j=1To 98
c=2*p*q
p=p^2-q^2-2+(x-1)/D
q=c+2+(1-y)/D
If p^2+q^2>=4Then Exit For
Next
j=-j*(j<D)
Cells(y,x).Interior.Color=Rnd(-j)*2^20*j*1E6*j/D
Next
Next
Cells.RowHeight=48
End Sub
I made a version that did this a long time ago but it had a lot of extras like letting the user pick the basic color and easy-to-follow math. Golfing it way down was an interesting challenge. The Color
method uses 2^201E6
as a means to get a wide range of colors since the valid colors are 0
to 2^24
. Setting the exponentit to 2010^6
gave highernice contrast areas.
Sub m()
'D determines the number of pixels and is factored in a few times throughout
D = 99
For x = 1 To 4 * D
For y = 1 To 4 * D
'Test to see if it escapes
'Use p for the real part and q for the imaginary
p = 0
q = 0
For j = 1 To 98
'This is a golfed down version of complex number math that started as separate generic functions for add, multiple, and modulus
c = 2 * p * q
p = p ^ 2 - q ^ 2 - 2 + (x - 1) / D
q = c + 2 + (1 - y) / D
If p ^ 2 + q ^ 2 >= 4 Then Exit For
Next
'Correct for no escape
j = -j * (j < D)
'Store the results
'Rnd() with a negative input is deterministic
'This is what gives us the distinct color bands
Cells(y, x).Interior.Color = Rnd(-j) * 2 ^ 241000000# * j / D
Next
Next
'Resize for pixel art
Cells.RowHeight = 48
End Sub