Greyscale requires encoding gamma for visual linear scale.

Mac gamma equals 2.2, so encoding gamma = 1/2.2 = 0.45.

Code: Select all

```
'Colour space with grey scale
'by "Dutchman" Ton Nillesen
'august 2019
sw sh = SCRSIZE|2
midx midy = sw/2 sh/2
Radius=INT(0.8*MIN(midx,midy))
Ratio=360/2/PI ' ratio between degrees and radians
dphi=0.9/Radius
'--- set grey radius
grey=INT(Radius/3)
'---- Graphics
DRAW CLEAR 0,0,0
phi=0
DO
dx=COS(phi) : dy=SIN(phi)
'--- greyscale, saturation=0
DRAW COLOR 0,0,0
DRAW POINT midx midy ' start at center
FOR i=0 to grey
DRAW COLOR HSV2RGB|3 (x, 0, (i/grey)^0.45) ' with encoding gamma
DRAW TO midx+i*dx midy+i*dy
NEXT
'---- saturating color
rest=Radius-grey
FOR i=0 TO rest
DRAW COLOR HSV2RGB|3 (phi*ratio, i/rest, 1)
DRAW TO midx+(grey+i)*dx midy+(grey+i)*dy
NEXT
phi+=dphi
REDO IF phi<2*PI
END
```