Difference between revisions of "Get Color Indices"

From PyMOLWiki
Jump to: navigation, search
m (trying to fix typos and adding how relates to iterate function.)
Line 1: Line 1:
'''get_color_indices''' will retrieve the RGB values for colors.
+
'''get_color_indices''' in combination with '''get_color_tuple''' will retrieve the RGB values for colors.
  
 
<source lang="python">
 
<source lang="python">
 
print cmd.get_color_indices()
 
print cmd.get_color_indices()
 
</source>
 
</source>
will retrieve the color indices
+
will retrieve the color names and corresponding  color indices.
  
<source lang="python">print cmd.get_color_tuple(index-number)</source> will retrieve individual RGB components.
+
<source lang="python">print cmd.get_color_tuple(index-number)</source> will retrieve individual RGB components when `index-number` is replaced with one of the color indices from above.
 +
 
 +
The color index, an integer, gets returned when color is returned while [[iterating|Iterate]]. You can thus use the  '''get_color_tuple''' command above to convert that to RGB color values if you need to use the colors outside Pymol.
  
 
<source lang="python">
 
<source lang="python">
Line 19: Line 21:
 
== See Also ==
 
== See Also ==
 
[[Get_Color_Tuples]]
 
[[Get_Color_Tuples]]
 +
[[Iterate]]
  
 
[[Category:Commands|Get Color Indices]]
 
[[Category:Commands|Get Color Indices]]
 
[[Category:Coloring|Get Color Indices]]
 
[[Category:Coloring|Get Color Indices]]

Revision as of 15:57, 2 March 2016

get_color_indices in combination with get_color_tuple will retrieve the RGB values for colors.

print cmd.get_color_indices()

will retrieve the color names and corresponding color indices.

print cmd.get_color_tuple(index-number)

will retrieve individual RGB components when `index-number` is replaced with one of the color indices from above.

The color index, an integer, gets returned when color is returned while Iterate. You can thus use the  get_color_tuple command above to convert that to RGB color values if you need to use the colors outside Pymol.
set_color color-name, [r,b,g]

will create a new color that will appear in the GUI list. From the open-source GUI you can use the "add" button in the color list viewer. In MacPyMOL, enter the new name into the MacPyMOL color editor window, set the RGBs, and then click Apply.

See Also

Get_Color_Tuples Iterate