The canvas background color is not changed by any of those lines commented (when uncommenting).
How to set the background color?
B4X:
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
cvs.Initialize("cvs")
MainForm.RootPane.AddNode(cvs, 0, 0,200,200) 'MainForm.Width/2, MainForm.Height/2)
'MainForm.BackColor=fx.colors.Green
'drawrect(0,0,cvs.Width,cvs.Height/2,fx.colors.yellow,True,0)
'cvs.style="-fx-background-color: yellow"