Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ColormakerRegistry

Class for registering Colormakers. Generally use the global {@link src/globals.js~ColormakerRegistry} instance.

Hierarchy

  • ColormakerRegistry

Index

Constructors

constructor

Properties

schemes

schemes: {}

Type declaration

  • [k: string]: any

userSchemes

userSchemes: {}

Type declaration

  • [k: string]: any

Methods

_addUserScheme

  • _addUserScheme(scheme: any, label?: undefined | string): string
  • Add a user-defined scheme

    Parameters

    • scheme: any

      the user-defined scheme

    • Optional label: undefined | string

    Returns string

    id to refer to the registered scheme

_createScheme

  • _createScheme(constructor: any): _Colormaker

add

addScheme

  • addScheme(scheme: any, label?: undefined | string): string
  • Register a custom scheme

    example

    // Create a class with a atomColor method that returns a hex color. var schemeId = NGL.ColormakerRegistry.addScheme( function( params ){ this.atomColor = function( atom ){ if( atom.serial < 1000 ){ return 0x0000FF; // blue }else if( atom.serial > 2000 ){ return 0xFF0000; // red }else{ return 0x00FF00; // green } }; } );

    stage.loadFile( "rcsb://3dqb.pdb" ).then( function( o ){ o.addRepresentation( "cartoon", { color: schemeId } ); // pass schemeId here o.autoView(); } );

    Parameters

    • scheme: any

      constructor or Colormaker instance

    • Optional label: undefined | string

      scheme label

    Returns string

    id to refer to the registered scheme

addSelectionScheme

  • Create and a selection-based coloring scheme. Supply a list with pairs of colorname and selection for coloring by selections. Use the last entry as a default (catch all) coloring definition.

    example

    var schemeId = NGL.ColormakerRegistry.addSelectionScheme( [ [ "red", "64-74 or 134-154 or 222-254 or 310-310 or 322-326" ], [ "green", "311-322" ], [ "yellow", "40-63 or 75-95 or 112-133 or 155-173 or 202-221 or 255-277 or 289-309" ], [ "blue", "1-39 or 96-112 or 174-201 or 278-288" ], [ "white", "*" ] ], "Transmembrane 3dqb" );

    stage.loadFile( "rcsb://3dqb.pdb" ).then( function( o ){ o.addRepresentation( "cartoon", { color: schemeId } ); // pass schemeId here o.autoView(); } );

    Parameters

    • dataList: SelectionSchemeData

      cloror-selection pairs

    • Optional label: undefined | string

      scheme name

    Returns string

    id to refer to the registered scheme

getModes

  • getModes(): { : string; hcl: string; hsi: string; hsl: string; hsv: string; lab: string; rgb: string }
  • Returns { : string; hcl: string; hsi: string; hsl: string; hsv: string; lab: string; rgb: string }

    • : string
    • hcl: string
    • hsi: string
    • hsl: string
    • hsv: string
    • lab: string
    • rgb: string

getScales

  • getScales(): { : string; Accent: string; Blues: string; BrBG: string; BuGn: string; BuPu: string; Dark2: string; GnBu: string; Greens: string; Greys: string; OrRd: string; Oranges: string; PRGn: string; Paired: string; Pastel1: string; Pastel2: string; PiYG: string; PuBu: string; PuBuGn: string; PuOr: string; PuRd: string; Purples: string; RdBu: string; RdGy: string; RdPu: string; RdYlBu: string; RdYlGn: string; Reds: string; Set1: string; Set2: string; Set3: string; Spectral: string; Viridis: string; YlGn: string; YlGnBu: string; YlOrBr: string; YlOrRd: string; rainbow: string; rwb: string }
  • Get an description of available scales as an object with id-label as key-value pairs

    Returns { : string; Accent: string; Blues: string; BrBG: string; BuGn: string; BuPu: string; Dark2: string; GnBu: string; Greens: string; Greys: string; OrRd: string; Oranges: string; PRGn: string; Paired: string; Pastel1: string; Pastel2: string; PiYG: string; PuBu: string; PuBuGn: string; PuOr: string; PuRd: string; Purples: string; RdBu: string; RdGy: string; RdPu: string; RdYlBu: string; RdYlGn: string; Reds: string; Set1: string; Set2: string; Set3: string; Spectral: string; Viridis: string; YlGn: string; YlGnBu: string; YlOrBr: string; YlOrRd: string; rainbow: string; rwb: string }

    available scales

    • : string
    • Accent: string
    • Blues: string
    • BrBG: string
    • BuGn: string
    • BuPu: string
    • Dark2: string
    • GnBu: string
    • Greens: string
    • Greys: string
    • OrRd: string
    • Oranges: string
    • PRGn: string
    • Paired: string
    • Pastel1: string
    • Pastel2: string
    • PiYG: string
    • PuBu: string
    • PuBuGn: string
    • PuOr: string
    • PuRd: string
    • Purples: string
    • RdBu: string
    • RdGy: string
    • RdPu: string
    • RdYlBu: string
    • RdYlGn: string
    • Reds: string
    • Set1: string
    • Set2: string
    • Set3: string
    • Spectral: string
    • Viridis: string
    • YlGn: string
    • YlGnBu: string
    • YlOrBr: string
    • YlOrRd: string
    • rainbow: string
    • rwb: string

getScheme

getSchemes

  • getSchemes(): {}
  • Get an description of available schemes as an object with id-label as key-value pairs

    Returns {}

    available schemes

    • [k: string]: any

hasScheme

  • hasScheme(id: string): boolean
  • Check if a scheme with the given id exists

    Parameters

    • id: string

      the id to check

    Returns boolean

    flag indicating if the scheme exists

removeScheme

  • removeScheme(id: string): void

Generated using TypeDoc