This version of the Help is no longer updated. See JMP.com/help for the latest version.

.
Scripting Guide > Scripting Graphs > Create a Color Picker
Publication date: 07/30/2020

Create a Color Picker

Let users select a color to apply to graphs by creating a color picker. Users can select a predefined color or create their own color. You can also specify a default color in your script.

Use the named or numbered colors shown in Colors and Markers in the Data Tables section.

or

Specify values between 0 and 1 for each of the red, blue, and green components in RGB Color().

Examples of Creating Color Pickers

The following example does not name the window, so the default title is used. Because the script does not specify a color, Black is selected by default. If the user selects a color in the color picker window, then the lines are drawn in the selected color.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Run Script( "Bivariate" );
Wait( 0 );
pickColor = Pick Color();
Report( biv )[AxisBox( 1 )] <<
Add Ref Line( 105, "Dashed", pickColor, "Mean" );

The following example creates a color picker with the window title “Select a Line Color”. BlueGreen is preselected.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Run Script( "Bivariate" );
Wait( 0 );
pickColor = Pick Color( "Select a Line Color", "BlueGreen" );
Report( biv )[AxisBox( 1 )] <<
Add Ref Line( 105, "Dashed", pickColor, "Mean" );

The following example creates a color picker with the window title “Select a Background Color”. BlueGreen is preselected.

picked color = Pick Color( "Select a Background Color", "BlueGreen" );
New Window( "Example",
       gb = Graph Box(
              Frame Size( 300, 300 ),
              Marker( Marker State( 3 ), [11 44 77], [75 25 50] );
              Line( [10 30 70], [88 22 44] );
       )
);
gb[FrameBox(1)] << Background Color ( picked color );

The following example specifies the RGB values for red, green, and blue to create pink. If you do not know the JMP color name or number, you might consider this option.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = dt << Run Script( "Bivariate" );
Wait( 0 );
pickColor = Pick Color( "RGB", RGBCOLOR( 1/*red*/, 0/*green*/, 1/*blue*/ ) );
Report( biv )[AxisBox( 1 )] <<
Add Ref Line( 105, "Dashed", pickColor, "Mean" );
Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).