Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio |PyJEM| Search

 

Example: Display the Colour Selection Tool
Function
Brings up a colour selection palette.
Version
version: 150311, v1.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments

This example script will display the colour selection palette. Once a colour has been selected a small colour image of that colour is displayed.

System Requirements
Should be compatible with all recent versions of DigitalMicrograph. Tested on GMS 2.3 running on XP.
Known Issues
-
Supported
Yes
Included Files
Main script file.
Source Code

// Example script which shows how to put up a colour selection dialog.

// After selection, a small image set to the colour of choice is displayed

 

// version:20150311, v1.0

// D. R. G. Mitchell, adminnospam@dmscripting.com (remove the nospam to make this address work)

// March 2015, www.dmscripting.com

 

 

// Select the default colour as white

 

rgbnumber default=rgb(255,255,255)

rgbnumber choice

 

 

// Put up the colour picker dialog

 

if(!GetRGBColorDialog( "Choose a colour", default, choice ) ) exit(0)

 

 

// Create and display a small swatch set to the chosen colour

 

rgbimage test=realimage("",4,256,256)

test=choice

showimage(test)