This is a read-only mirror of pymolwiki.org
Difference between revisions of "Get colors"
Jump to navigation
Jump to search
(created get_colors page) |
m (3 revisions) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 11: | Line 11: | ||
* Note that basic colors can be accessed manually without this script from the PyMOL menu under '''Setting''' --> '''Colors...''' | * 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 | + | * For instruction on setting up plugin import see [[Git intro]] or [[Plugin Manager]] |
[[Image:1LSD_random_colors.png|right|300px|1LSD colored randomly by residue]] | [[Image:1LSD_random_colors.png|right|300px|1LSD colored randomly by residue]] | ||
Line 57: | Line 57: | ||
* [[Color]] | * [[Color]] | ||
* [[Get Color Indices]] | * [[Get Color Indices]] | ||
+ | |||
+ | [[Category:Script_Library]] | ||
+ | [[Category:UI_Scripts]] |
Latest revision as of 15:24, 26 November 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
Usage
get_colors [ selection [, quiet ]] get_random_color [ selection [, quiet ]]
Examples
# 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.delete('all')
cmd.fetch('1LSD', async=0) # :P
cmd.hide('everything')
cmd.show_as('sticks','not hetatm')
cmd.orient()
python # start a python block
from pymol import stored
stored.atom_list=[]
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
cmd.ray()
|