Color.FillColor

From Xojo Documentation

Method

The system's window background color.

Usage

result = Color.FillColor

Part Type Description
result Color The color used for drawing the background of controls and windows.

Notes

This value is useful when you are using Canvas controls to create custom controls. When drawing objects, use this color to fill the background.

This value can be changed by the user or when the system changes between light and dark modes, so you should use this method in the Paint event handler rather than storing the value.

FillColor matches the default Window Background on all platforms, except for macOS in DarkMode. Use Graphics.ClearRectangle to properly clear the window so that it's background color displays when using Dark Mode.

Sample Code

This example uses the system fill color to set the color of a square with a 3D "raised" look. The code is in the Paint event of a Canvas.

Const White = &cffffff
Const DarkGray = &c8c8c8c

g.DrawingColor = White
g.DrawLine(1, 1, Me.Width, 1)
g.DrawLine(1, Me.Height - 1, 1, 1)
g.DrawingColor = DarkGray
g.DrawLine(Me.Width - 1, 2, Me.Width - 1, Me.Height)
g.DrawLine(1, Me.Height - 1, Me.Width, Me.Height - 1)
// Fill in using the system Fill color
g.DrawingColor = Color.FillColor
g.FillRectangle(2, 2, Me.Width - 3, Me.Height - 3)

See Also

Color for a complete list of functions; Canvas, Graphics classes; UserGuide:Dark Mode topic.