Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow colorschemes in colorfunc #605

Open
duerrsimon opened this issue Jun 29, 2022 · 4 comments
Open

Allow colorschemes in colorfunc #605

duerrsimon opened this issue Jun 29, 2022 · 4 comments

Comments

@duerrsimon
Copy link

duerrsimon commented Jun 29, 2022

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"
      }
  }
@0xClint
Copy link

0xClint commented Jan 28, 2023

@duerrsimon I want to contribute to this issue can you assign this to me?

@dkoes
Copy link
Contributor

dkoes commented Jan 28, 2023

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:

  1. Modify getColorFromStyle so it's comment is parsed as a jsdoc comment and it shows up in the documentation (it is missing an *).
  2. 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)
  3. Add a test that evaluates this functionality.
  4. Submit a pull request with the result that references this issue.

@0xClint
Copy link

0xClint commented Jan 29, 2023

Hey @dkoes , is their any starter guide to setup the github repo, getting some error in setting the project.

@dkoes
Copy link
Contributor

dkoes commented Jan 29, 2023

Clone the repo and then run npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants