Testing new update of SmallBASIC, I found I hadn't expressed full range for G and B colors so here is that "fix" with an R or G or B full intensity palette plus a bunch of key or mouse navigation of s range 0 to 995 and color on/off toggle and +- magnifications.
' patterns 2.bas  SmallBASIC 0.12.7 [B+=MGA] 2016-09-18
' from pattern.bas for SmallBASIC 0.12.0 2015-11-27 Peter W & MGA/B+
' 2016-09-18 modify (Fix!) to full range R OR G OR B coloring
' test new 0.12.7 update SmallBASIC (2016-09-17)
' add toggles for rectangles 1 to 8 with + for plus, - for minus
' add toggles c for color to B & W
' add keys u, d, h, e  for like: page up, page down, home, end
' add label, extra code to speed B&W versions
definekey 43, plusPress   ' + increase reactangle size up to 8x8 pixels
definekey 45, minusPress  ' - decrease rectangle size to 1x1 = pixels
definekey 99, cPress      'color toggle B&W
definekey 98, bPress   'b  for back 5,     s back 5 = last s again
definekey 117, uPress  'u  like page up,   s + 100, also click right screen
definekey 100, dPress  'd  like page down, s - 100, also click left screen
definekey 104, hPress  'h  like home,      s = 10 , also click top screen
definekey 101, ePress  'e  like end,       s = 900, also click bottom screen
colr = 1 'color is on
g = 2    'g controls f the rectangle size
u = 500  'u controls s that controls the d number that controls color
pen on
while 1
  cls
  f = g
  s = u
  if colr then
    for i = 0 to xmax / f
      for j = 0 to (ymax - 20) / f
        x = i * s / 600
        y = j * s / 600
        c = x * x + y * y
        d = c / 2
        d = d - int(d)
        if d < .35 then
          cc = rgbf(d / .35, 0, 0)
        elif d < .7
          cc = rgbf(0, (d - .35) / .35, 0)  'get full range % 
        else
          cc = rgbf(0, 0, (1 - d) / .30000001) 'get full range %
        fi    
        rect i * f,j * f + 21 step f, f, cc filled
        'pset i,j,cc
      next
    next
  else
    for i = 0 to xmax / f
      for j = 0 to (ymax - 20) / f
        x = i * s / 600
        y = j * s / 600
        c = x * x + y * y
        d = c / 2
        d = d - int(d)
        if d < 0.35 then rect i * f, j * f + 21 step f, f, 15 filled    
      next
    next
  end if
  color 7, 0
  ts = "Patterns 2: s = " + str(s) + ", " + str(f) + "x"
  ts = ts + str(f) + "  key: + - pixel magnification, c color on/off, b backup,"
  ts = ts + " u d h e or click to naviagte s"
  at (xmax -txtw(ts))/2, 1 : ? ts
  showpage
  pause 'for snapshot
  if pen(3) then
    mx = pen(4) : my = pen(5)
    delay 100
    if my > 100 and my < ymax - 100 then 
      if mx < 100 then dPress
      if mx > xmax - 100 then uPress
    elif my < 100 and my > -1
      hPress
    elif my > ymax - 100  
      ePress
    end if
  end if
  u += 5
  if u > 1000 then u = 5
wend
sub plusPress()
  g = iff(f + 1 < 9, f + 1, f)
end
sub minusPress()
  g = iff(f - 1 > 0, f - 1, f)
end
sub cPress()
  colr = (colr + 1) % 2
end
sub bPress()
  u = iff(u - 10 > 0, u - 10, 990) 
end
   
sub uPress()
  u = iff(u + 100 < 1000, u + 100, 900)
end 
  
sub dPress()
  u = iff(u - 100 > 0, u - 100, 5)
end
  
sub hPress()
  u = 5
end
sub ePress()
  u = 900
end sub