Color Column in Worksheet

Origin 2021 introduces a Color column type with HTML color code support. Color codes entered into the column will show as the cell background color. The user can easily build color lists or palettes with such a column. The user can also directly use the column for applying color to plots. 

Below are some usage examples.

Extract colors from an image

With color column and Python improvements in Origin 2021, we made a built-in worksheet template to easily extract HTML colors from an image.  Choose File: New: Workbook… menu. Then on the System Templates tab, choose Image Colors. 

Double-clicking the column D header, you can see the column Format is set as Color.

Click the Pick an Image to extract colors button. If you are asked to install the extcolors Python package, choose Yes to install it. Pick an image file and the R, G, B and HTML colors will be extracted into columns A – D.

Single-click on the column D header and a Mini Toolbar will show. Click the Save button to save the colors for future use. Depending on the number of colors in the column, you will be prompted to save as a color increment list or palette. See Notes for more information.

Once saved, you can use these color increment lists and palettes as you would any other.

Notes:

  • You can delete rows or right-click the color column and choose Sort Worksheet: Ascending or Descending, etc. before saving the colors.
  • System variable @MPS (default value = 25) controls the saving behavior. If there are 25 or more colors in the color column, the colors will be saved as a palette file (*.pal) under the User Files\Palettes\ folder . If there are 24 or less colors, the colors will be saved as color increment list file (*.oth) under User Files\Themes\Graph\ folder.
  • Press the ALT key and double-click on Python Code to see the Python code that extracts colors.
  • Press the ALT key and double-click the Pick an Image to extract colors button to see how to make a button and call the Python code.

Customize Plot by Color Column

After plotting data, the user can click the plot and use the color button on the Mini Toolbar to set the plot color by Color column.

E.g. in this example, add column C as Color column. Enter html code.

set color to be By Points and choose RGB: Col(C) to apply HTML colors in column C to each data point.

If you don’t know an HTML color code, you can click a Color cell and use the Edit Color Value dropdown list on the Mini Toolbar to pick a color or create a new color.

Leave a Reply

Your email address will not be published. Required fields are marked *