Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

uisetcolor

Open color picker

Syntax

  • c = uisetcolor
  • c = uisetcolor(RGB)
    example
  • c = uisetcolor(obj)

Description

c = uisetcolor displays a modal color picker and returns the selected color as an RGB triplet. The RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the selected color. The intensities are in the range [0,1] and are of type double.

example

c = uisetcolor(RGB) specifies the default color selection as an RGB triplet.

c = uisetcolor(obj) sets the default color selection to be the color of an object (such as a Figure). The object must have the Color property.

example

c = uisetcolor(___,title) specifies a custom title for the dialog box. Specify the title as the last argument for any of the above syntaxes.

Examples

collapse all

Open the color picker with light blue as the default color.

c = uisetcolor([0.6 0.8 1])

Clicking the OK button without selecting a different color returns the default color.

c =

     0.6000    0.8000    1.0000

Open the color picker with yellow as the default color and set the title to 'Select a Color'.

c = uisetcolor([1 1 0],'Select a color')

Clicking the OK button without selecting a different color returns the default color.

c =

     1     1     0

Input Arguments

collapse all

Default color, specified as an RGB triplet. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the selected color. The intensities must be in the range [0,1].

Example: c = uisetcolor([1 0 0]) specifies red as the default color selection.

Example: c = uisetcolor([0.5 0.5 0.5]) specifies gray as the default color selection.

Data Types: single | double

Source object for default color, specified as a graphics object. You must specify an object (such as a Figure or Axes) that has the Color property.

Example: c = uisetcolor(figure) creates a Figure and sets the default color selection to be the same color as the figure.

Title of dialog box, specified as a character vector.

Example: c = uisetcolor('Choose a Color') specifies 'Choose a Color' as the dialog box title.

Data Types: char

More About

collapse all

Modal Window

A window that blocks interaction with other windows until the user closes it.

Introduced before R2006a

Was this topic helpful?