Get colors: Difference between revisions
Jump to navigation
Jump to search
m (Fixing capitalization) |
PedroLacerda (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{Infobox script-repo | {{Infobox script-repo | ||
|type = Python Module | |type = Python Module | ||
|filename = get_colors.py | |filename = scripts/get_colors.py | ||
|author = [[User:Andwar|Andreas Warnecke]] | |author = [[User:Andwar|Andreas Warnecke]] | ||
|license = BSD-2-Clause | |license = BSD-2-Clause | ||
Line 60: | Line 60: | ||
[[Category:Script_Library]] | [[Category:Script_Library]] | ||
[[Category:UI_Scripts]] | [[Category:UI_Scripts]] | ||
[[Category:Pymol-script-repo]] |
Latest revision as of 23:55, 22 June 2025
Type | Python Module |
---|---|
Download | scripts/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()
|