Difference between revisions of "Get colors"

From PyMOLWiki
Jump to: navigation, search
(created get_colors page)
m (added category)
Line 57: Line 57:
* [[Color]]
* [[Color]]
* [[Get Color Indices]]
* [[Get Color Indices]]

Revision as of 08:46, 10 June 2014

Type Python Module
Download get_colors.py
Author(s) Andreas Warnecke
License BSD-2-Clause
This code has been put under version control in the project Pymol-script-repo
  • get_colors contains two functions that can be useful when working with colors
    • get_colors : returns all available PyMOL colors
    • get_random_color : returns a random available PyMOL color
  • Note that basic colors can be accessed manually without this script from the PyMOL menu under Setting --> Colors...
  • For instruction on setting up plugin import see Git intro or Plugin manager
1LSD colored randomly by residue


get_colors [ selection [, quiet ]]
get_random_color [ selection [, quiet ]]


# basic example
get_colors # basic colors
get colors all # larger range with intermediates
#get disco funky
import get_colors
from get_colors import get_colors
from get_colors import get_random_color

cmd.fetch('1LSD', async=0) # :P
cmd.show_as('sticks','not hetatm')

python # start a python block
from pymol import stored
cmd.iterate('name CA','stored.atom_list.append([model, resi])')
resi_list=["model %s and resi %s"%(value[0],value[1]) for value in stored.atom_list]
for resi in resi_list: cmd.color(get_random_color(),resi)
python end # end python block