Main Content

colordef

(To be removed) Set default property values to display different color schemes

colordef will be removed in a future release.

Syntax

colordef white
colordef black
colordef none
colordef(fig,color_option)
h = colordef('new',color_option)

Description

colordef enables you to select either a white or black background for graphics display. It sets axis lines and labels so that they contrast with the background color.

colordef white sets the axis background, axis lines and labels, and the figure background to the default system colors.

colordef black sets the axis background color to black, the axis lines and labels to white, and the figure background color to dark gray.

colordef none sets the figure coloring to that used by MATLAB® Version 4. The most noticeable difference is that the axis background is set to 'none', making the axis background and figure background colors the same. The figure background color is set to black.

colordef(fig,color_option) sets the color scheme of the figure identified by the handle fig to one of the color options 'white', 'black', or 'none'. When you use this syntax to apply colordef to an existing figure, the figure must have no graphic content. If it does, you should first clear it (via clf) before using this form of the command.

h = colordef('new',color_option) returns the handle to a new figure created with the specified color options (i.e., 'white', 'black', or 'none'). This form of the command is useful for creating GUIs when you may want to control the default environment. The figure is created with 'visible','off' to prevent flashing.

Tips

colordef affects only subsequently drawn figures, not those currently on the display. This is because colordef works by setting default property values (on the root or figure level). You can list the currently set default values on the root level with the statement

get(groot,'Default')

You can remove all default values using the reset command:

reset(groot)

See the get and reset references pages for more information.

Version History

Introduced before R2006a

collapse all

R2024a: colordef will be removed

The colordef issues a warning that it will be removed in a future release.

See Also