# cdCanvasSetForeground

Definition: | include pGUI.e cdCanvasSetForeground(cdCanvas canvas, integer colour) -- or -- integer colour = cdCanvasGetForeground(cdCanvas canvas)
Description: | Configures a new current foreground color, or retrieves the current setting. This color is used in all primitives (lines, areas, marks and text). Default value: CD_BLACK.
pwa/p2js: | Supported. Note the Get functions in pGUI.js yield a string, eg "#010203", not #010203, and the Set functions can accept either a string or an integer.
Comments: | In C, cdCanvasForeground performs a get/set with a conflict over CD_QUERY(/WHITE), and it is suggested to use cdCanvasSetForeground to avoid that conflict (nb there is no C function named cdCanvasGetForground). In pGUI.e, the procedure cdCanvasSetForeground() and the function cdCanvasGetForeground() are used in the obvious and non-conflicting way, and you might occasionally need to replace one C call with a Get followed by a Set in pGUI. The C function cdForeground(c) ceased to be available in version 3.25. The routines cdCanvasSetBackground() and cdCanvasGetBackground() are practically identical, and not separately documented, and likewise pGUI.e does not define cdBackground and cdCanvasBackground, instead there must always be "Canvas" and either "Get" or "Set" in the routine name. The cdCanvasSetBackground() routine only affects cdCanvasClear().
See Also: | See also Color Coding.