3Dmol.js
3Dmol.js copied to clipboard
Allow colorschemes in colorfunc
Is your feature request related to a problem? Please describe. It is a bit counterintuitive that colorfunc only allows to return colors and not the normal colorschemes
Describe the solution you'd like
let colorFixedSidechain = function(atom){
if (selectedResidues.includes(atom.resi)){
return "red"
}else{
return "WhiteCarbon"
}
}
Describe alternatives you've considered
let colorFixedSidechain = function(atom){
if (selectedResidues.includes(atom.resi)){
return "red"
}else if (atom.elem == "O"){
return "red"
}else if (atom.elem == "N"){
return "blue"
}else if (atom.elem == "S"){
return "yellow"
}else{
return "lightgray"
}
}
@duerrsimon I want to contribute to this issue can you assign this to me?
I really think the right solution is to implement colorfunc using getColorFromStyle:
let colorFixedSidechain = function(atom){
if (selectedResidues.includes(atom.resi)){
return "red"
}else{
return $3Dmol.getColorFromStyle(atom, {colorscheme: "whiteCarbon"});
}
}
@Omkar0803 If you'd like to get started contributed to the codebase, a nice easy first step to best resolve this issue is:
- Modify getColorFromStyle so it's comment is parsed as a jsdoc comment and it shows up in the documentation (it is missing an
*). - Modify getColorFromStyle os it can accept a string as well as a style object that will be assumed to be a color scheme name (so the above can be written more succinctly)
- Add a test that evaluates this functionality.
- Submit a pull request with the result that references this issue.
Hey @dkoes , is their any starter guide to setup the github repo, getting some error in setting the project.
Clone the repo and then run npm install