diff --git a/src/apps/viewer/extensions/jolecule.ts b/src/apps/viewer/extensions/jolecule.ts index ca058c307e0f4dd52a64eb048292c6b3bd25e60f..b7e0548f1314b9018ead728698734b122662a765 100644 --- a/src/apps/viewer/extensions/jolecule.ts +++ b/src/apps/viewer/extensions/jolecule.ts @@ -16,7 +16,7 @@ import { PluginStateSnapshotManager } from '../../../mol-plugin/state/snapshots' import { MolScriptBuilder as MS } from '../../../mol-script/language/builder'; import { Text } from '../../../mol-geo/geometry/text/text'; import { UUID } from '../../../mol-util'; -import { ColorNames } from '../../../mol-util/color/tables'; +import { ColorNames } from '../../../mol-util/color/names'; import { Camera } from '../../../mol-canvas3d/camera'; import { StructureRepresentation3DHelpers } from '../../../mol-plugin/state/transforms/representation'; diff --git a/src/examples/proteopedia-wrapper/index.ts b/src/examples/proteopedia-wrapper/index.ts index 1aa4f7c2a3bb521618a28da4e80d80c592546267..ccb9614653601055027c32c99e1347f429085b43 100644 --- a/src/examples/proteopedia-wrapper/index.ts +++ b/src/examples/proteopedia-wrapper/index.ts @@ -26,7 +26,7 @@ import { MolScriptBuilder as MS } from '../../mol-script/language/builder'; import { BuiltInStructureRepresentations } from '../../mol-repr/structure/registry'; import { BuiltInColorThemes } from '../../mol-theme/color'; import { BuiltInSizeThemes } from '../../mol-theme/size'; -import { ColorNames } from '../../mol-util/color/tables'; +import { ColorNames } from '../../mol-util/color/names'; import { InitVolumeStreaming, CreateVolumeStreamingInfo } from '../../mol-plugin/behavior/dynamic/volume-streaming/transformers'; import { ParamDefinition } from '../../mol-util/param-definition'; import { DefaultCanvas3DParams, Canvas3DProps } from '../../mol-canvas3d/canvas3d'; diff --git a/src/mol-canvas3d/helper/bounding-sphere-helper.ts b/src/mol-canvas3d/helper/bounding-sphere-helper.ts index 2574795adff90ae182d02aac00930030103c6466..4d0d18e2c026da2e68c7490c944144ba005974ea 100644 --- a/src/mol-canvas3d/helper/bounding-sphere-helper.ts +++ b/src/mol-canvas3d/helper/bounding-sphere-helper.ts @@ -13,7 +13,7 @@ import Scene from '../../mol-gl/scene'; import { WebGLContext } from '../../mol-gl/webgl/context'; import { Sphere3D } from '../../mol-math/geometry'; import { Color } from '../../mol-util/color'; -import { ColorNames } from '../../mol-util/color/tables'; +import { ColorNames } from '../../mol-util/color/names'; import { TransformData } from '../../mol-geo/geometry/transform-data'; import { sphereVertexCount } from '../../mol-geo/primitive/sphere'; import { ValueCell } from '../../mol-util'; diff --git a/src/mol-geo/geometry/base.ts b/src/mol-geo/geometry/base.ts index e103fa29229d23812099ccf2f2ed25f640d13907..318a67c4b9ebee8b1265f052d2ed398b3033ec90 100644 --- a/src/mol-geo/geometry/base.ts +++ b/src/mol-geo/geometry/base.ts @@ -13,7 +13,7 @@ import { Color } from '../../mol-util/color'; import { Vec3 } from '../../mol-math/linear-algebra'; import { TransformData, createIdentityTransform } from './transform-data'; import { Theme } from '../../mol-theme/theme'; -import { ColorNames } from '../../mol-util/color/tables'; +import { ColorNames } from '../../mol-util/color/names'; import { NullLocation } from '../../mol-model/location'; import { UniformColorTheme } from '../../mol-theme/color/uniform'; import { UniformSizeTheme } from '../../mol-theme/size/uniform'; diff --git a/src/mol-geo/geometry/direct-volume/direct-volume.ts b/src/mol-geo/geometry/direct-volume/direct-volume.ts index 33bdc759fa8a4c087d721b6f4b85292c41c194fa..3b3b89568931cfdc08ed8319c157525e7023def3 100644 --- a/src/mol-geo/geometry/direct-volume/direct-volume.ts +++ b/src/mol-geo/geometry/direct-volume/direct-volume.ts @@ -21,7 +21,7 @@ import { transformPositionArray } from '../../../mol-geo/util'; import { calculateBoundingSphere } from '../../../mol-gl/renderable/util'; import { Theme } from '../../../mol-theme/theme'; import { RenderableState } from '../../../mol-gl/renderable'; -import { ColorListOptions, ColorListName } from '../../../mol-util/color/scale'; +import { ColorListOptions, ColorListName } from '../../../mol-util/color/lists'; import { Color } from '../../../mol-util/color'; import { BaseGeometry } from '../base'; import { createEmptyOverpaint } from '../overpaint-data'; @@ -81,7 +81,7 @@ export namespace DirectVolume { Vec2.create(0.19, 0.0), Vec2.create(0.2, 0.05), Vec2.create(0.25, 0.05), Vec2.create(0.26, 0.0), Vec2.create(0.79, 0.0), Vec2.create(0.8, 0.05), Vec2.create(0.85, 0.05), Vec2.create(0.86, 0.0), ]), - list: PD.ColorScale<ColorListName>('RedYellowBlue', ColorListOptions), + list: PD.ColorScale<ColorListName>('red-yellow-blue', ColorListOptions), } export type Params = typeof Params diff --git a/src/mol-geo/geometry/direct-volume/transfer-function.ts b/src/mol-geo/geometry/direct-volume/transfer-function.ts index bce6328420c1498950504a8a11e11e4003c0ea8c..2fd3ec13f907ab30f6845b05c5ee6937e4a0d5b7 100644 --- a/src/mol-geo/geometry/direct-volume/transfer-function.ts +++ b/src/mol-geo/geometry/direct-volume/transfer-function.ts @@ -9,7 +9,7 @@ import { spline } from '../../../mol-math/interpolate'; import { ColorScale, Color } from '../../../mol-util/color'; import { ValueCell } from '../../../mol-util'; import { Vec2 } from '../../../mol-math/linear-algebra'; -import { ColorListName } from '../../../mol-util/color/scale'; +import { ColorListName } from '../../../mol-util/color/lists'; export interface ControlPoint { x: number, alpha: number } diff --git a/src/mol-geo/geometry/text/text.ts b/src/mol-geo/geometry/text/text.ts index cfbb2d31dbe3c5427860732ab11da5e05288f7d4..39507efe8916742e585167020aaf86266c10c5a9 100644 --- a/src/mol-geo/geometry/text/text.ts +++ b/src/mol-geo/geometry/text/text.ts @@ -13,7 +13,7 @@ import { Theme } from '../../../mol-theme/theme'; import { createColors } from '../color-data'; import { createSizes, getMaxSize } from '../size-data'; import { createMarkers } from '../marker-data'; -import { ColorNames } from '../../../mol-util/color/tables'; +import { ColorNames } from '../../../mol-util/color/names'; import { Sphere3D } from '../../../mol-math/geometry'; import { calculateBoundingSphere, TextureImage, createTextureImage } from '../../../mol-gl/renderable/util'; import { TextValues } from '../../../mol-gl/renderable/text'; diff --git a/src/mol-model-formats/shape/ply.ts b/src/mol-model-formats/shape/ply.ts index f0a6b91879bf239ede409b285832e2415e0165f3..533337dd55e3fb1fa288d3b51c232e772eb512fd 100644 --- a/src/mol-model-formats/shape/ply.ts +++ b/src/mol-model-formats/shape/ply.ts @@ -16,7 +16,7 @@ import { ChunkedArray } from '../../mol-data/util'; import { arrayMax, fillSerial } from '../../mol-util/array'; import { Column } from '../../mol-data/db'; import { ParamDefinition as PD } from '../../mol-util/param-definition'; -import { ColorNames } from '../../mol-util/color/tables'; +import { ColorNames } from '../../mol-util/color/names'; import { deepClone } from '../../mol-util/object'; // TODO support 'edge' element, see https://www.mathworks.com/help/vision/ug/the-ply-format.html diff --git a/src/mol-model-props/common/custom-element-property.ts b/src/mol-model-props/common/custom-element-property.ts index e2e2315bb5a4b61cc2136a8e3f76af5e7d8d06f2..77d4bad48aff7d69089ad9894d46d7fab50f4450 100644 --- a/src/mol-model-props/common/custom-element-property.ts +++ b/src/mol-model-props/common/custom-element-property.ts @@ -12,7 +12,7 @@ import { Task } from '../../mol-task'; import { ThemeDataContext, ThemeProvider } from '../../mol-theme/theme'; import { ColorTheme, LocationColor } from '../../mol-theme/color'; import { Color } from '../../mol-util/color'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; import { Loci } from '../../mol-model/loci'; import { OrderedSet } from '../../mol-data/int'; diff --git a/src/mol-model-props/pdbe/themes/structure-quality-report.ts b/src/mol-model-props/pdbe/themes/structure-quality-report.ts index b6b8df769ff2b9fb558efe31d052ef8ceb9ba823..ce9915af9c1592d65df9bcaa37cd3ef71fdd1eae 100644 --- a/src/mol-model-props/pdbe/themes/structure-quality-report.ts +++ b/src/mol-model-props/pdbe/themes/structure-quality-report.ts @@ -10,7 +10,7 @@ import { StructureElement } from '../../../mol-model/structure'; import { ColorTheme, LocationColor } from '../../../mol-theme/color'; import { ThemeDataContext } from '../../../mol-theme/theme'; import { Color } from '../../../mol-util/color'; -import { TableLegend } from '../../../mol-util/color/tables'; +import { TableLegend } from '../../../mol-util/color/lists'; const ValidationColors = [ Color.fromRgb(170, 170, 170), // not applicable diff --git a/src/mol-model-props/rcsb/themes/assembly-symmetry-cluster.ts b/src/mol-model-props/rcsb/themes/assembly-symmetry-cluster.ts index 86866a062b619a89a0938acbd447904a71d34240..d435ee69aab28dba4033e6cf45c937286e4e4e69 100644 --- a/src/mol-model-props/rcsb/themes/assembly-symmetry-cluster.ts +++ b/src/mol-model-props/rcsb/themes/assembly-symmetry-cluster.ts @@ -15,7 +15,7 @@ import { Location } from '../../../mol-model/location'; import { ScaleLegend } from '../../../mol-util/color/scale'; import { getSymmetrySelectParam } from '../util'; import { getPalette, getPaletteParams } from '../../../mol-theme/color/util'; -import { TableLegend } from '../../../mol-util/color/tables'; +import { TableLegend } from '../../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) @@ -34,7 +34,7 @@ function clusterMemberKey(assemblyId: string, asymId: string, operList: string[] } export const AssemblySymmetryClusterColorThemeParams = { - ...getPaletteParams({ scaleList: 'RedYellowBlue' }), + ...getPaletteParams({ scaleList: 'red-yellow-blue' }), symmetryId: getSymmetrySelectParam(), } export type AssemblySymmetryClusterColorThemeParams = typeof AssemblySymmetryClusterColorThemeParams diff --git a/src/mol-plugin/behavior/dynamic/labels.ts b/src/mol-plugin/behavior/dynamic/labels.ts index cc45ec7ea5dcc03af2923de55150d25458ea2e8c..7873a7efd3e96eee028903a2ee13f0b4745db4f2 100644 --- a/src/mol-plugin/behavior/dynamic/labels.ts +++ b/src/mol-plugin/behavior/dynamic/labels.ts @@ -14,7 +14,7 @@ import { RuntimeContext } from '../../../mol-task'; import { Shape } from '../../../mol-model/shape'; import { Text } from '../../../mol-geo/geometry/text/text'; import { ShapeRepresentation } from '../../../mol-repr/shape/representation'; -import { ColorNames } from '../../../mol-util/color/tables'; +import { ColorNames } from '../../../mol-util/color/names'; import { TextBuilder } from '../../../mol-geo/geometry/text/text-builder'; import { Unit, StructureElement, StructureProperties } from '../../../mol-model/structure'; import { SetUtils } from '../../../mol-util/set'; diff --git a/src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts b/src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts index 7221b05a7079b114198ccc9e7c408e3aad6dbfd0..e585d317da9a2ea61d3dd2b422680855507a294d 100644 --- a/src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts +++ b/src/mol-plugin/behavior/dynamic/selection/structure-representation-interaction.ts @@ -16,7 +16,7 @@ import { MolScriptBuilder as MS } from '../../../../mol-script/language/builder' import { StateObjectCell, StateSelection, StateTransform } from '../../../../mol-state'; import { BuiltInColorThemes } from '../../../../mol-theme/color'; import { BuiltInSizeThemes } from '../../../../mol-theme/size'; -import { ColorNames } from '../../../../mol-util/color/tables'; +import { ColorNames } from '../../../../mol-util/color/names'; import { ButtonsType } from '../../../../mol-util/input/input-observer'; import { Representation } from '../../../../mol-repr/representation'; diff --git a/src/mol-plugin/state/actions/volume.ts b/src/mol-plugin/state/actions/volume.ts index 70951e9fe312cfd40f284e914f50ee37bd1822ba..4559cc8a9505546db0c042e9f02a66375eb15aab 100644 --- a/src/mol-plugin/state/actions/volume.ts +++ b/src/mol-plugin/state/actions/volume.ts @@ -9,7 +9,7 @@ import { VolumeIsoValue } from '../../../mol-model/volume'; import { PluginContext } from '../../../mol-plugin/context'; import { State, StateAction, StateBuilder, StateTransformer } from '../../../mol-state'; import { Task } from '../../../mol-task'; -import { ColorNames } from '../../../mol-util/color/tables'; +import { ColorNames } from '../../../mol-util/color/names'; import { FileInfo, getFileInfo } from '../../../mol-util/file-info'; import { ParamDefinition as PD } from '../../../mol-util/param-definition'; import { PluginStateObject } from '../objects'; diff --git a/src/mol-plugin/state/transforms/representation.ts b/src/mol-plugin/state/transforms/representation.ts index 35ede9697349cd7eae3a13c5d2dcd7023dc8c5c0..8ec62e7bd908a5634619b9ec122e09b024baff38 100644 --- a/src/mol-plugin/state/transforms/representation.ts +++ b/src/mol-plugin/state/transforms/representation.ts @@ -21,7 +21,7 @@ import { createTheme, ThemeRegistryContext } from '../../../mol-theme/theme'; import { ParamDefinition as PD } from '../../../mol-util/param-definition'; import { PluginStateObject as SO, PluginStateTransform } from '../objects'; import { Text } from '../../../mol-geo/geometry/text/text'; -import { ColorNames } from '../../../mol-util/color/tables'; +import { ColorNames } from '../../../mol-util/color/names'; import { getLabelRepresentation } from '../../../mol-plugin/util/structure-labels'; import { ShapeRepresentation } from '../../../mol-repr/shape/representation'; import { StructureUnitTransforms } from '../../../mol-model/structure/structure/util/unit-transforms'; diff --git a/src/mol-plugin/ui/sequence/hetero.ts b/src/mol-plugin/ui/sequence/hetero.ts index dd436aa5ba2690a059a359aa710093780287be48..e42017d80586f99c1a62bef931b9b77e3fb2f3b8 100644 --- a/src/mol-plugin/ui/sequence/hetero.ts +++ b/src/mol-plugin/ui/sequence/hetero.ts @@ -8,7 +8,7 @@ import { Structure, StructureElement, ResidueIndex } from '../../../mol-model/st import { SequenceWrapper, StructureUnit } from './wrapper'; import { OrderedSet, Segmentation, Interval, SortedArray } from '../../../mol-data/int'; import { Loci } from '../../../mol-model/loci'; -import { ColorNames } from '../../../mol-util/color/tables'; +import { ColorNames } from '../../../mol-util/color/names'; export class HeteroSequenceWrapper extends SequenceWrapper<StructureUnit> { private readonly sequence: string[] diff --git a/src/mol-plugin/ui/sequence/polymer.ts b/src/mol-plugin/ui/sequence/polymer.ts index aecdaa22158e4d1784ad3ca47808d807b5ad7a87..0e5f1a26db92772cc621f8060d27e5a1075f9d8e 100644 --- a/src/mol-plugin/ui/sequence/polymer.ts +++ b/src/mol-plugin/ui/sequence/polymer.ts @@ -10,7 +10,7 @@ import { OrderedSet, Interval, SortedArray } from '../../../mol-data/int'; import { Loci } from '../../../mol-model/loci'; import { Sequence } from '../../../mol-model/sequence'; import { MissingResidues } from '../../../mol-model/structure/model/properties/common'; -import { ColorNames } from '../../../mol-util/color/tables'; +import { ColorNames } from '../../../mol-util/color/names'; export class PolymerSequenceWrapper extends SequenceWrapper<StructureUnit> { private readonly sequence: Sequence diff --git a/src/mol-plugin/util/structure-labels.ts b/src/mol-plugin/util/structure-labels.ts index e66efd60bb1434c1167c9d17cc659768f42948e2..3e315953fd9f2fafc260cf4407f9b16b7ebbf4b1 100644 --- a/src/mol-plugin/util/structure-labels.ts +++ b/src/mol-plugin/util/structure-labels.ts @@ -12,7 +12,7 @@ import { Vec3 } from '../../mol-math/linear-algebra'; import { Text } from '../../mol-geo/geometry/text/text'; import { TextBuilder } from '../../mol-geo/geometry/text/text-builder'; import { Shape } from '../../mol-model/shape'; -import { ColorNames } from '../../mol-util/color/tables'; +import { ColorNames } from '../../mol-util/color/names'; import { RuntimeContext } from '../../mol-task'; import { ParamDefinition as PD } from '../../mol-util/param-definition'; import { BoundaryHelper } from '../../mol-math/geometry/boundary-helper'; diff --git a/src/mol-theme/color.ts b/src/mol-theme/color.ts index bc8104c95c6d216ce72f6192a8d32765ae46ca1d..29ea808574de9632d64910191832ab9850974610 100644 --- a/src/mol-theme/color.ts +++ b/src/mol-theme/color.ts @@ -25,7 +25,7 @@ import { SequenceIdColorThemeProvider } from './color/sequence-id'; import { ShapeGroupColorThemeProvider } from './color/shape-group'; import { UnitIndexColorThemeProvider } from './color/unit-index'; import { ScaleLegend } from '../mol-util/color/scale'; -import { TableLegend } from '../mol-util/color/tables'; +import { TableLegend } from '../mol-util/color/lists'; import { UncertaintyColorThemeProvider } from './color/uncertainty'; import { EntitySourceColorThemeProvider } from './color/entity-source'; import { IllustrativeColorThemeProvider } from './color/illustrative'; diff --git a/src/mol-theme/color/carbohydrate-symbol.ts b/src/mol-theme/color/carbohydrate-symbol.ts index 734df427eb2691c03c556acbc208b0bede2ec3cc..accf9f6f00b7a9099d37e249aa61da548a0844a6 100644 --- a/src/mol-theme/color/carbohydrate-symbol.ts +++ b/src/mol-theme/color/carbohydrate-symbol.ts @@ -11,7 +11,7 @@ import { ColorTheme, LocationColor } from '../color'; import { Color } from '../../mol-util/color'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../theme'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) const Description = 'Assigns colors according to the Symbol Nomenclature for Glycans (SNFG).' diff --git a/src/mol-theme/color/chain-id.ts b/src/mol-theme/color/chain-id.ts index f18257c6c5535fe34638eb6ce565581259c9e78c..089dd2d78f11767157e16bca3d963846d346ac3a 100644 --- a/src/mol-theme/color/chain-id.ts +++ b/src/mol-theme/color/chain-id.ts @@ -13,13 +13,13 @@ import { ThemeDataContext } from '../../mol-theme/theme'; import { ScaleLegend } from '../../mol-util/color/scale'; import { Column } from '../../mol-data/db'; import { getPaletteParams, getPalette } from './util'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) const Description = 'Gives every chain a color based on its `asym_id` value.' export const ChainIdColorThemeParams = { - ...getPaletteParams({ scaleList: 'RedYellowBlue' }), + ...getPaletteParams({ scaleList: 'red-yellow-blue' }), } export type ChainIdColorThemeParams = typeof ChainIdColorThemeParams export function getChainIdColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/cross-link.ts b/src/mol-theme/color/cross-link.ts index 31c9058e065805fdb5d7761b8f9cee4bc98ba176..e4f31dd014d548924899077f57ffd976e28034da 100644 --- a/src/mol-theme/color/cross-link.ts +++ b/src/mol-theme/color/cross-link.ts @@ -11,14 +11,14 @@ import { ColorTheme, LocationColor } from '../color'; import { Vec3 } from '../../mol-math/linear-algebra'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../../mol-theme/theme'; -import { ColorListName, ColorListOptions } from '../../mol-util/color/scale'; +import { ColorListName, ColorListOptions } from '../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) const Description = 'Colors cross-links by the deviation of the observed distance versus the modeled distance (e.g. `ihm_cross_link_restraint.distance_threshold`).' export const CrossLinkColorThemeParams = { domain: PD.Interval([-10, 10]), - list: PD.ColorScale<ColorListName>('RedGrey', ColorListOptions), + list: PD.ColorScale<ColorListName>('red-grey', ColorListOptions), } export type CrossLinkColorThemeParams = typeof CrossLinkColorThemeParams export function getCrossLinkColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/element-index.ts b/src/mol-theme/color/element-index.ts index 8ae0b949a9070acd7d3afe9f90dcdd66d0b48c92..ed84607c7892eab070a7bf7499812899bd0c5969 100644 --- a/src/mol-theme/color/element-index.ts +++ b/src/mol-theme/color/element-index.ts @@ -11,13 +11,13 @@ import { OrderedSet } from '../../mol-data/int'; import { ColorTheme, LocationColor } from '../color'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../../mol-theme/theme'; -import { ColorListOptions, ColorListName } from '../../mol-util/color/scale'; +import { ColorListOptions, ColorListName } from '../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) const Description = 'Gives every element (atom or coarse sphere/gaussian) a unique color based on the position (index) of the element in the list of elements in the structure.' export const ElementIndexColorThemeParams = { - list: PD.ColorScale<ColorListName>('RedYellowBlue', ColorListOptions), + list: PD.ColorScale<ColorListName>('red-yellow-blue', ColorListOptions), } export type ElementIndexColorThemeParams = typeof ElementIndexColorThemeParams export function getElementIndexColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/element-symbol.ts b/src/mol-theme/color/element-symbol.ts index b34dd6fd56972bce2cf7bba74d4342151f6b8a78..208c56df90566832bac934c4456a39ad2ba72b07 100644 --- a/src/mol-theme/color/element-symbol.ts +++ b/src/mol-theme/color/element-symbol.ts @@ -11,7 +11,7 @@ import { Location } from '../../mol-model/location'; import { ColorTheme } from '../color'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../theme'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; import { getAdjustedColorMap } from '../../mol-util/color/color'; // from Jmol http://jmol.sourceforge.net/jscolors/ (or 0xFFFFFF) diff --git a/src/mol-theme/color/entity-source.ts b/src/mol-theme/color/entity-source.ts index 02178af7751bb1c53f92d6047887dd6fc947c3e1..e3be5eb8ead44fa23f9d8ca5a9de4cbf64cd9d31 100644 --- a/src/mol-theme/color/entity-source.ts +++ b/src/mol-theme/color/entity-source.ts @@ -14,13 +14,13 @@ import { ScaleLegend } from '../../mol-util/color/scale'; import { Table, Column } from '../../mol-data/db'; import { mmCIF_Schema } from '../../mol-io/reader/cif/schema/mmcif'; import { getPaletteParams, getPalette } from './util'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) const Description = 'Gives ranges of a polymer chain a color based on the entity source it originates from. Genes get the same color per entity' export const EntitySourceColorThemeParams = { - ...getPaletteParams({ scaleList: 'RedYellowBlue' }), + ...getPaletteParams({ scaleList: 'red-yellow-blue' }), } export type EntitySourceColorThemeParams = typeof EntitySourceColorThemeParams export function getEntitySourceColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/hydrophobicity.ts b/src/mol-theme/color/hydrophobicity.ts index eb933335c33110d182f8655808f37502daedfe19..eb171a21fe3b9f969162ccda36bac473ed502cc7 100644 --- a/src/mol-theme/color/hydrophobicity.ts +++ b/src/mol-theme/color/hydrophobicity.ts @@ -11,12 +11,12 @@ import { ColorTheme } from '../color'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../theme'; import { ResidueHydrophobicity } from '../../mol-model/structure/model/types'; -import { ColorListName, ColorListOptions } from '../../mol-util/color/scale'; +import { ColorListName, ColorListOptions } from '../../mol-util/color/lists'; const Description = 'Assigns a color to every amino acid according to the "Experimentally determined hydrophobicity scale for proteins at membrane interfaces" by Wimely and White (doi:10.1038/nsb1096-842).' export const HydrophobicityColorThemeParams = { - list: PD.ColorScale<ColorListName>('RedYellowGreen', ColorListOptions), + list: PD.ColorScale<ColorListName>('red-yellow-green', ColorListOptions), scale: PD.Select('DGwif', [['DGwif', 'DG water-membrane'], ['DGwoct', 'DG water-octanol'], ['Oct-IF', 'DG difference']]) } export type HydrophobicityColorThemeParams = typeof HydrophobicityColorThemeParams diff --git a/src/mol-theme/color/model-index.ts b/src/mol-theme/color/model-index.ts index 1478125cdaafe35338727786b150b1957ee01eb8..f7857456fec8cc52fb7d8eef45aabaad55b26128 100644 --- a/src/mol-theme/color/model-index.ts +++ b/src/mol-theme/color/model-index.ts @@ -12,13 +12,13 @@ import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../../mol-theme/theme'; import { ScaleLegend } from '../../mol-util/color/scale'; import { getPaletteParams, getPalette } from './util'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) const Description = 'Gives every model a unique color based on the position (index) of the model in the list of models in the structure.' export const ModelIndexColorThemeParams = { - ...getPaletteParams({ scaleList: 'RedYellowBlue' }), + ...getPaletteParams({ scaleList: 'red-yellow-blue' }), } export type ModelIndexColorThemeParams = typeof ModelIndexColorThemeParams export function getModelIndexColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/molecule-type.ts b/src/mol-theme/color/molecule-type.ts index 57e7ab795db4693113c2e15be5a9f44a25ead2bb..6054175fb559835aa75f25f24cb80d3e6faac913 100644 --- a/src/mol-theme/color/molecule-type.ts +++ b/src/mol-theme/color/molecule-type.ts @@ -12,7 +12,7 @@ import { MoleculeType } from '../../mol-model/structure/model/types'; import { getElementMoleculeType } from '../../mol-model/structure/util'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../theme'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; import { getAdjustedColorMap } from '../../mol-util/color/color'; export const MoleculeTypeColors = ColorMap({ diff --git a/src/mol-theme/color/polymer-id.ts b/src/mol-theme/color/polymer-id.ts index a5a3ba72f60306990d79752816630ad353ab4563..06801584402819d3ca259e6f17452e81100395e8 100644 --- a/src/mol-theme/color/polymer-id.ts +++ b/src/mol-theme/color/polymer-id.ts @@ -15,13 +15,13 @@ import { Column } from '../../mol-data/db'; import { Entities } from '../../mol-model/structure/model/properties/common'; import { getPalette, getPaletteParams } from './util'; import { ScaleLegend } from '../../mol-util/color/scale'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) const Description = 'Gives every polymer chain a color based on its `asym_id` value.' export const PolymerIdColorThemeParams = { - ...getPaletteParams({ scaleList: 'RedYellowBlue' }), + ...getPaletteParams({ scaleList: 'red-yellow-blue' }), } export type PolymerIdColorThemeParams = typeof PolymerIdColorThemeParams export function getPolymerIdColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/polymer-index.ts b/src/mol-theme/color/polymer-index.ts index 1a19450433ef14fbee84cc53df8d1e58412f3af6..5130950412e0b99ece55c2d6eb91bf089bf86891 100644 --- a/src/mol-theme/color/polymer-index.ts +++ b/src/mol-theme/color/polymer-index.ts @@ -11,14 +11,14 @@ import { ColorTheme, LocationColor } from '../color'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../../mol-theme/theme'; import { ScaleLegend } from '../../mol-util/color/scale'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; import { getPaletteParams, getPalette } from './util'; const DefaultColor = Color(0xCCCCCC) const Description = 'Gives every polymer a unique color based on the position (index) of the polymer in the list of polymers in the structure.' export const PolymerIndexColorThemeParams = { - ...getPaletteParams({ scaleList: 'RedYellowBlue' }), + ...getPaletteParams({ scaleList: 'red-yellow-blue' }), } export type PolymerIndexColorThemeParams = typeof PolymerIndexColorThemeParams export function getPolymerIndexColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/residue-name.ts b/src/mol-theme/color/residue-name.ts index b488e259445c3696c2680a296d8904a5946a11c4..f3014fa18c2e7c030ea179853346522b9bd171b1 100644 --- a/src/mol-theme/color/residue-name.ts +++ b/src/mol-theme/color/residue-name.ts @@ -10,7 +10,7 @@ import { Location } from '../../mol-model/location'; import { ColorTheme } from '../color'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../theme'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; import { getAdjustedColorMap } from '../../mol-util/color/color'; // protein colors from Jmol http://jmol.sourceforge.net/jscolors/ diff --git a/src/mol-theme/color/secondary-structure.ts b/src/mol-theme/color/secondary-structure.ts index 1d49c38a11fff52ead281a1b4727d8ff06a215fd..6249f79a39270a45f8a790c177a36f069d4cde3e 100644 --- a/src/mol-theme/color/secondary-structure.ts +++ b/src/mol-theme/color/secondary-structure.ts @@ -12,7 +12,7 @@ import { SecondaryStructureType, MoleculeType } from '../../mol-model/structure/ import { getElementMoleculeType } from '../../mol-model/structure/util'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../theme'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; import { ComputedSecondaryStructure } from '../../mol-model-props/computed/secondary-structure'; import { getAdjustedColorMap } from '../../mol-util/color/color'; diff --git a/src/mol-theme/color/sequence-id.ts b/src/mol-theme/color/sequence-id.ts index c7f11f3e4f9d7c30ae4be3f62fccd0ea3e525697..2219068c000a2742611ae387afbdd114c7e7a4ee 100644 --- a/src/mol-theme/color/sequence-id.ts +++ b/src/mol-theme/color/sequence-id.ts @@ -11,13 +11,13 @@ import { Location } from '../../mol-model/location'; import { ColorTheme } from '../color'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../../mol-theme/theme'; -import { ColorListOptions, ColorListName } from '../../mol-util/color/scale'; +import { ColorListOptions, ColorListName } from '../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) const Description = 'Gives every polymer residue a color based on its `seq_id` value.' export const SequenceIdColorThemeParams = { - list: PD.ColorScale<ColorListName>('Rainbow', ColorListOptions), + list: PD.ColorScale<ColorListName>('rainbow', ColorListOptions), } export type SequenceIdColorThemeParams = typeof SequenceIdColorThemeParams export function getSequenceIdColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/uncertainty.ts b/src/mol-theme/color/uncertainty.ts index c8d629fbf18be05efeede237c5b408ba4567bedd..ea69bf70c4b5e9e08af08ca4b215857bae746a56 100644 --- a/src/mol-theme/color/uncertainty.ts +++ b/src/mol-theme/color/uncertainty.ts @@ -10,14 +10,14 @@ import { Location } from '../../mol-model/location'; import { ColorTheme } from '../color'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../theme'; -import { ColorListName, ColorListOptions } from '../../mol-util/color/scale'; +import { ColorListName, ColorListOptions } from '../../mol-util/color/lists'; const DefaultUncertaintyColor = Color(0xffff99) const Description = `Assigns a color based on the uncertainty of an element's position, , e.g. B-factor or RMSF, depending on the data availability and experimental technique.` export const UncertaintyColorThemeParams = { domain: PD.Interval([0, 100]), - list: PD.ColorScale<ColorListName>('RedWhiteBlue', ColorListOptions), + list: PD.ColorScale<ColorListName>('red-white-blue', ColorListOptions), } export type UncertaintyColorThemeParams = typeof UncertaintyColorThemeParams export function getUncertaintyColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/uniform.ts b/src/mol-theme/color/uniform.ts index 5fa271563f20f8808bd818d7c2eca739f54bd07a..4fdb7c2d427129cd9d1be257650a49037e67a14b 100644 --- a/src/mol-theme/color/uniform.ts +++ b/src/mol-theme/color/uniform.ts @@ -8,7 +8,7 @@ import { ColorTheme } from '../color'; import { Color } from '../../mol-util/color'; import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../theme'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; import { defaults } from '../../mol-util'; const DefaultColor = Color(0xCCCCCC) diff --git a/src/mol-theme/color/unit-index.ts b/src/mol-theme/color/unit-index.ts index 213c1d933f9c3b41e8e51c0a4f4a5b380b68f0ce..9876f424d6cf6dba3eda5a8d24a6fa655f983400 100644 --- a/src/mol-theme/color/unit-index.ts +++ b/src/mol-theme/color/unit-index.ts @@ -12,13 +12,13 @@ import { ParamDefinition as PD } from '../../mol-util/param-definition' import { ThemeDataContext } from '../../mol-theme/theme'; import { ScaleLegend } from '../../mol-util/color/scale'; import { getPaletteParams, getPalette } from './util'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend } from '../../mol-util/color/lists'; const DefaultColor = Color(0xCCCCCC) const Description = 'Gives every unit (single chain or collection of single elements) a unique color based on the position (index) of the unit in the list of units in the structure.' export const UnitIndexColorThemeParams = { - ...getPaletteParams({ scaleList: 'RedYellowBlue' }), + ...getPaletteParams({ scaleList: 'red-yellow-blue' }), } export type UnitIndexColorThemeParams = typeof UnitIndexColorThemeParams export function getUnitIndexColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/mol-theme/color/util.ts b/src/mol-theme/color/util.ts index 45d5752ff1caa9de21fb051d3e161f453a1016c6..9119e1729c77b967fedad05c0890d6230bc5cfcf 100644 --- a/src/mol-theme/color/util.ts +++ b/src/mol-theme/color/util.ts @@ -6,12 +6,13 @@ import { ParamDefinition as PD } from '../../mol-util/param-definition' import { DistinctColorsParams, distinctColors } from '../../mol-util/color/distinct'; -import { ColorListName, ColorListOptions, ScaleLegend, ColorScale } from '../../mol-util/color/scale'; +import { ScaleLegend, ColorScale } from '../../mol-util/color/scale'; import { Color } from '../../mol-util/color'; -import { TableLegend } from '../../mol-util/color/tables'; +import { TableLegend, ColorListName, ColorListOptionsScale, ColorListOptionsSet, getColorListFromName } from '../../mol-util/color/lists'; const DefaultGetPaletteProps = { - scaleList: 'RedYellowBlue' as ColorListName + scaleList: 'red-yellow-blue' as ColorListName, + setList: 'set-1' as ColorListName } type GetPaletteProps = typeof DefaultGetPaletteProps @@ -20,7 +21,10 @@ export function getPaletteParams(props: Partial<GetPaletteProps> = {}) { return { palette: PD.MappedStatic('generate', { scale: PD.Group({ - list: PD.ColorScale<ColorListName>(p.scaleList, ColorListOptions), + list: PD.ColorScale<ColorListName>(p.scaleList, ColorListOptionsScale), + }, { isFlat: true }), + set: PD.Group({ + list: PD.ColorScale<ColorListName>(p.setList, ColorListOptionsSet), }, { isFlat: true }), generate: PD.Group({ ...DistinctColorsParams, @@ -29,6 +33,7 @@ export function getPaletteParams(props: Partial<GetPaletteProps> = {}) { }, { options: [ ['scale', 'From Scale'], + ['set', 'From Set'], ['generate', 'Generate Distinct'] ] }) @@ -54,9 +59,16 @@ export function getPalette(count: number, props: PaletteProps) { legend = scale.legend color = scale.color } else { - count = Math.min(count, props.palette.params.maxCount) - const colors = distinctColors(count, props.palette.params) - color = (i: number) => colors[i % count] + let colors: Color[] + if (props.palette.name === 'set') { + const listOrName = props.palette.params.list + colors = typeof listOrName === 'string' ? getColorListFromName(listOrName) : listOrName + } else { + count = Math.min(count, props.palette.params.maxCount) + colors = distinctColors(count, props.palette.params) + } + const colorsLength = colors.length + color = (i: number) => colors[i % colorsLength] } return { color, legend } diff --git a/src/mol-util/color/color.ts b/src/mol-util/color/color.ts index 993fcd5cc2da2cf2e389185732b57e4567ba65ff..7df516c9d8f6edec6e0ae25f1dcab24353e8a9a6 100644 --- a/src/mol-util/color/color.ts +++ b/src/mol-util/color/color.ts @@ -120,6 +120,16 @@ export namespace Color { } } +export interface ColorList { + label: string + description: string + list: Color[] + type: 'sequential' | 'diverging' | 'qualitative' +} +export function ColorList(label: string, type: 'sequential' | 'diverging' | 'qualitative', description: string, list: number[]): ColorList { + return { label, description, list: list as Color[], type } +} + export type ColorTable<T extends { [k: string]: number[] }> = { [k in keyof T]: Color[] } export function ColorTable<T extends { [k: string]: number[] }>(o: T) { return o as unknown as ColorTable<T> } diff --git a/src/mol-util/color/lists.ts b/src/mol-util/color/lists.ts new file mode 100644 index 0000000000000000000000000000000000000000..c07110133c9ce3780d724a0127a13701054e2794 --- /dev/null +++ b/src/mol-util/color/lists.ts @@ -0,0 +1,215 @@ +/** + * Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { Color, ColorList } from './color'; + +export interface TableLegend { + kind: 'table-legend' + table: [ string, Color ][] +} +export function TableLegend(table: [ string, Color ][]): TableLegend { + return { kind: 'table-legend', table } +} + +export const ColorLists = { + /** + * Brewer Color Lists + * + * Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University. + * Licensed under the Apache License, Version 2.0 (the "License"); + */ + 'orange-red': ColorList('Orange-Red', 'sequential', + 'Orange-Red, sequential color scheme from ColorBrewer 2.0', + [0xfff7ec, 0xfee8c8, 0xfdd49e, 0xfdbb84, 0xfc8d59, 0xef6548, 0xd7301f, 0xb30000, 0x7f0000] + ), + 'purple-blue': ColorList('Purple-Blue', 'sequential', + 'Purple-Blue, sequential color scheme from ColorBrewer 2.0', + [0xfff7fb, 0xece7f2, 0xd0d1e6, 0xa6bddb, 0x74a9cf, 0x3690c0, 0x0570b0, 0x045a8d, 0x023858] + ), + 'blue-purple': ColorList('Blue-Purple', 'sequential', + 'Blue-Purple, sequential color scheme from ColorBrewer 2.0', + [0xf7fcfd, 0xe0ecf4, 0xbfd3e6, 0x9ebcda, 0x8c96c6, 0x8c6bb1, 0x88419d, 0x810f7c, 0x4d004b] + ), + 'oranges': ColorList('Oranges', 'sequential', + '', + [0xfff5eb, 0xfee6ce, 0xfdd0a2, 0xfdae6b, 0xfd8d3c, 0xf16913, 0xd94801, 0xa63603, 0x7f2704] + ), + 'blue-green': ColorList('Blue-Green', 'sequential', + '', + [0xf7fcfd, 0xe5f5f9, 0xccece6, 0x99d8c9, 0x66c2a4, 0x41ae76, 0x238b45, 0x006d2c, 0x00441b] + ), + 'yellow-orange-brown': ColorList('Yellow-Orange-Brown', 'sequential', + '', + [0xffffe5, 0xfff7bc, 0xfee391, 0xfec44f, 0xfe9929, 0xec7014, 0xcc4c02, 0x993404, 0x662506] + ), + 'yellow-green': ColorList('Yellow-Green', 'sequential', + '', + [0xffffe5, 0xf7fcb9, 0xd9f0a3, 0xaddd8e, 0x78c679, 0x41ab5d, 0x238443, 0x006837, 0x004529] + ), + 'reds': ColorList('Reds', 'sequential', + '', + [0xfff5f0, 0xfee0d2, 0xfcbba1, 0xfc9272, 0xfb6a4a, 0xef3b2c, 0xcb181d, 0xa50f15, 0x67000d] + ), + 'red-purple': ColorList('Red-Purple', 'sequential', + '', + [0xfff7f3, 0xfde0dd, 0xfcc5c0, 0xfa9fb5, 0xf768a1, 0xdd3497, 0xae017e, 0x7a0177, 0x49006a] + ), + 'greens': ColorList('Greens', 'sequential', + '', + [0xf7fcf5, 0xe5f5e0, 0xc7e9c0, 0xa1d99b, 0x74c476, 0x41ab5d, 0x238b45, 0x006d2c, 0x00441b] + ), + 'yellow-green-blue': ColorList('Yellow-Green-Blue', 'sequential', + '', + [0xffffd9, 0xedf8b1, 0xc7e9b4, 0x7fcdbb, 0x41b6c4, 0x1d91c0, 0x225ea8, 0x253494, 0x081d58] + ), + 'purples': ColorList('Purples', 'sequential', + '', + [0xfcfbfd, 0xefedf5, 0xdadaeb, 0xbcbddc, 0x9e9ac8, 0x807dba, 0x6a51a3, 0x54278f, 0x3f007d] + ), + 'green-blue': ColorList('Green-Blue', 'sequential', + '', + [0xf7fcf0, 0xe0f3db, 0xccebc5, 0xa8ddb5, 0x7bccc4, 0x4eb3d3, 0x2b8cbe, 0x0868ac, 0x084081] + ), + 'greys': ColorList('Greys', 'sequential', + '', + [0xffffff, 0xf0f0f0, 0xd9d9d9, 0xbdbdbd, 0x969696, 0x737373, 0x525252, 0x252525, 0x000000] + ), + 'yellow-orange-red': ColorList('Yellow-Orange-Red', 'sequential', + '', + [0xffffcc, 0xffeda0, 0xfed976, 0xfeb24c, 0xfd8d3c, 0xfc4e2a, 0xe31a1c, 0xbd0026, 0x800026] + ), + 'purple-red': ColorList('Purple-Red', 'sequential', + '', + [0xf7f4f9, 0xe7e1ef, 0xd4b9da, 0xc994c7, 0xdf65b0, 0xe7298a, 0xce1256, 0x980043, 0x67001f] + ), + 'blues': ColorList('Blues', 'sequential', + '', + [0xf7fbff, 0xdeebf7, 0xc6dbef, 0x9ecae1, 0x6baed6, 0x4292c6, 0x2171b5, 0x08519c, 0x08306b] + ), + 'purple-blue-green': ColorList('Purple-Blue-Green', 'sequential', + '', + [0xfff7fb, 0xece2f0, 0xd0d1e6, 0xa6bddb, 0x67a9cf, 0x3690c0, 0x02818a, 0x016c59, 0x014636] + ), + 'spectral': ColorList('Spectral', 'diverging', + '', + [0x9e0142, 0xd53e4f, 0xf46d43, 0xfdae61, 0xfee08b, 0xffffbf, 0xe6f598, 0xabdda4, 0x66c2a5, 0x3288bd, 0x5e4fa2] + ), + 'red-yellow-green': ColorList('Red-Yellow-Green', 'diverging', + '', + [0xa50026, 0xd73027, 0xf46d43, 0xfdae61, 0xfee08b, 0xffffbf, 0xd9ef8b, 0xa6d96a, 0x66bd63, 0x1a9850, 0x006837] + ), + 'red-blue': ColorList('Red-Blue', 'diverging', + '', + [0x67001f, 0xb2182b, 0xd6604d, 0xf4a582, 0xfddbc7, 0xf7f7f7, 0xd1e5f0, 0x92c5de, 0x4393c3, 0x2166ac, 0x053061] + ), + 'pink-yellow-green': ColorList('Pink-Yellow-Green', 'diverging', + '', + [0x8e0152, 0xc51b7d, 0xde77ae, 0xf1b6da, 0xfde0ef, 0xf7f7f7, 0xe6f5d0, 0xb8e186, 0x7fbc41, 0x4d9221, 0x276419] + ), + 'purple-green': ColorList('Purple-Green', 'diverging', + '', + [0x40004b, 0x762a83, 0x9970ab, 0xc2a5cf, 0xe7d4e8, 0xf7f7f7, 0xd9f0d3, 0xa6dba0, 0x5aae61, 0x1b7837, 0x00441b] + ), + 'red-yellow-blue': ColorList('Red-Yellow-Blue', 'diverging', + 'Red-Yellow-Blue, diverging color scheme from ColorBrewer 2.0', + [0xa50026, 0xd73027, 0xf46d43, 0xfdae61, 0xfee090, 0xffffbf, 0xe0f3f8, 0xabd9e9, 0x74add1, 0x4575b4, 0x313695] + ), + 'brown-white-green': ColorList('Brown-White-Green', 'diverging', + '', + [0x543005, 0x8c510a, 0xbf812d, 0xdfc27d, 0xf6e8c3, 0xf5f5f5, 0xc7eae5, 0x80cdc1, 0x35978f, 0x01665e, 0x003c30] + ), + 'red-grey': ColorList('Red-Grey', 'diverging', + '', + [0x67001f, 0xb2182b, 0xd6604d, 0xf4a582, 0xfddbc7, 0xffffff, 0xe0e0e0, 0xbababa, 0x878787, 0x4d4d4d, 0x1a1a1a] + ), + 'purple-orange': ColorList('Purple-Orange', 'diverging', + '', + [0x7f3b08, 0xb35806, 0xe08214, 0xfdb863, 0xfee0b6, 0xf7f7f7, 0xd8daeb, 0xb2abd2, 0x8073ac, 0x542788, 0x2d004b] + ), + 'set-2': ColorList('Set-2', 'qualitative', + '', + [0x66c2a5, 0xfc8d62, 0x8da0cb, 0xe78ac3, 0xa6d854, 0xffd92f, 0xe5c494, 0xb3b3b3] + ), + 'accent': ColorList('Accent', 'qualitative', + '', + [0x7fc97f, 0xbeaed4, 0xfdc086, 0xffff99, 0x386cb0, 0xf0027f, 0xbf5b17, 0x666666] + ), + 'set-1': ColorList('Set-1', 'qualitative', + '', + [0xe41a1c, 0x377eb8, 0x4daf4a, 0x984ea3, 0xff7f00, 0xffff33, 0xa65628, 0xf781bf, 0x999999] + ), + 'set-3': ColorList('Set-3', 'qualitative', + '', + [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3, 0xfdb462, 0xb3de69, 0xfccde5, 0xd9d9d9, 0xbc80bd, 0xccebc5, 0xffed6f] + ), + 'dark-2': ColorList('Dark-2', 'qualitative', + '', + [0x1b9e77, 0xd95f02, 0x7570b3, 0xe7298a, 0x66a61e, 0xe6ab02, 0xa6761d, 0x666666] + ), + 'paired': ColorList('Paired', 'qualitative', + '', + [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99, 0xe31a1c, 0xfdbf6f, 0xff7f00, 0xcab2d6, 0x6a3d9a, 0xffff99, 0xb15928] + ), + 'pastel-2': ColorList('Pastel-2', 'qualitative', + '', + [0xb3e2cd, 0xfdcdac, 0xcbd5e8, 0xf4cae4, 0xe6f5c9, 0xfff2ae, 0xf1e2cc, 0xcccccc] + ), + 'pastel-1': ColorList('Pastel-1', 'qualitative', + '', + [0xfbb4ae, 0xb3cde3, 0xccebc5, 0xdecbe4, 0xfed9a6, 0xffffcc, 0xe5d8bd, 0xfddaec, 0xf2f2f2] + ), + + /** + * Matplotlib colormaps, including various perceptually uniform shades, see https://bids.github.io/colormap/ + */ + 'magma': ColorList('Magma', 'diverging', + 'Perceptually uniform shades of black-red-white', + [0x420f74, 0x4a1079, 0x52127c, 0x5a157e, 0x61187f, 0x691c80, 0x711f81, 0x792281, 0x812581, 0x892881, 0x912a80, 0x992d7f, 0xa12f7e, 0xa9327c, 0xb1357a, 0xb93778, 0xc23a75, 0xca3e72, 0xd1426e, 0xd9466a, 0xe04b66, 0xe65162, 0xec585f, 0xf0605d, 0xf4685b, 0xf7715b, 0xf97b5d, 0xfb8460, 0xfc8e63, 0xfd9768, 0xfda16e, 0xfeaa74, 0xfeb37b, 0xfebc82, 0xfec689, 0xfdcf92, 0xfdd89a, 0xfde1a3, 0xfceaac, 0xfcf3b5, 0xfbfcbf] + ), + 'inferno': ColorList('Inferno', 'diverging', + 'Perceptually uniform shades of black-red-yellow', + [0x480b6a, 0x500d6c, 0x58106d, 0x60136e, 0x68166e, 0x70196e, 0x781c6d, 0x801f6b, 0x88216a, 0x902468, 0x982765, 0xa02a62, 0xa72d5f, 0xaf315b, 0xb73456, 0xbe3852, 0xc53d4d, 0xcc4148, 0xd24742, 0xd94d3d, 0xde5337, 0xe45a31, 0xe8612b, 0xed6825, 0xf0701e, 0xf37918, 0xf68111, 0xf88a0b, 0xfa9306, 0xfb9d06, 0xfba60b, 0xfbb014, 0xfbb91e, 0xf9c32a, 0xf8cd37, 0xf5d745, 0xf3e056, 0xf1e968, 0xf1f27d, 0xf5f891, 0xfcfea4], + ), + 'plasma': ColorList('Plasma', 'diverging', + 'Perceptually uniform shades of blue-red-yellow', + [0x1b068c, 0x250591, 0x2f0495, 0x380499, 0x40039c, 0x49029f, 0x5101a2, 0x5901a4, 0x6100a6, 0x6800a7, 0x7000a8, 0x7801a8, 0x7f03a7, 0x8607a6, 0x8e0ca4, 0x9511a1, 0x9b179e, 0xa21c9a, 0xa82296, 0xae2791, 0xb42d8d, 0xb93388, 0xbe3883, 0xc33e7f, 0xc8447a, 0xcd4975, 0xd14f71, 0xd6556d, 0xda5a68, 0xde6064, 0xe26660, 0xe56c5b, 0xe97257, 0xec7853, 0xef7e4e, 0xf2854a, 0xf58b46, 0xf79241, 0xf9993d, 0xfaa039, 0xfca735, 0xfdaf31, 0xfdb62d, 0xfdbe29, 0xfdc626, 0xfcce25, 0xfad624, 0xf8df24, 0xf5e726, 0xf2f026, 0xeff821] + ), + 'viridis': ColorList('Viridis', 'diverging', + 'Perceptually uniform shades of blue-green-yellow', + [0x45085b, 0x470f62, 0x471669, 0x481d6f, 0x482374, 0x472a79, 0x46307d, 0x453681, 0x433c84, 0x414286, 0x3e4888, 0x3c4d8a, 0x3a538b, 0x37588c, 0x355d8c, 0x32628d, 0x30678d, 0x2e6c8e, 0x2c718e, 0x2a768e, 0x287a8e, 0x267f8e, 0x24848d, 0x23898d, 0x218d8c, 0x1f928c, 0x1e978a, 0x1e9b89, 0x1ea087, 0x20a585, 0x23a982, 0x28ae7f, 0x2eb27c, 0x35b778, 0x3dbb74, 0x45bf6f, 0x4fc369, 0x59c764, 0x64cb5d, 0x70ce56, 0x7cd24f, 0x88d547, 0x95d73f, 0xa2da37, 0xafdc2e, 0xbdde26, 0xcae01e, 0xd7e219, 0xe4e318, 0xf1e51c, 0xfde724] + ), + 'cividis': ColorList('Cividis', 'diverging', + 'Perceptually uniform shades of blue-green-yellow, should look effectively identical to colorblind and non-colorblind users', + [0x002c67, 0x003070, 0x083370, 0x16366f, 0x1f3a6e, 0x273d6d, 0x2e416c, 0x34446c, 0x39486c, 0x3f4b6b, 0x444f6b, 0x49526b, 0x4e566c, 0x52596c, 0x575d6d, 0x5b606e, 0x60646e, 0x64676f, 0x686b71, 0x6d6e72, 0x717273, 0x757575, 0x797977, 0x7e7d78, 0x838078, 0x878478, 0x8c8878, 0x918c77, 0x968f77, 0x9b9376, 0xa09775, 0xa59b73, 0xaa9f72, 0xafa370, 0xb4a76f, 0xb9ab6d, 0xbeb06a, 0xc4b468, 0xc9b865, 0xcebc62, 0xd4c15e, 0xd9c55a, 0xdfca56, 0xe4ce51, 0xead34c, 0xefd846, 0xf5dc3f, 0xfbe136, 0xfde737] + ), + 'twilight': ColorList('Twilight', 'diverging', + 'Perceptually uniform shades of white-blue-black-red-white, cyclic', + [0xdfd9e1, 0xd8d7dd, 0xced3d8, 0xc2cdd3, 0xb4c7ce, 0xa7c0ca, 0x9ab8c7, 0x8eb0c5, 0x83a8c3, 0x7a9fc2, 0x7297c0, 0x6b8ebf, 0x6684bd, 0x637bbb, 0x6171b9, 0x5f67b6, 0x5e5cb2, 0x5e51ad, 0x5d46a7, 0x5c3c9f, 0x5b3196, 0x58278b, 0x531e7d, 0x4d176e, 0x46135f, 0x3e1151, 0x381045, 0x32113b, 0x301336, 0x361138, 0x3e113c, 0x471240, 0x521445, 0x5e1749, 0x6a1a4d, 0x761e4f, 0x812350, 0x8b2a50, 0x95324f, 0x9d3a4f, 0xa5434f, 0xac4d50, 0xb25752, 0xb86155, 0xbc6c59, 0xc0775f, 0xc48267, 0xc78d70, 0xc9987b, 0xcca389, 0xceae97, 0xd2b8a6, 0xd6c1b5, 0xdacac4, 0xddd1d1, 0xe0d6db, 0xe1d8e1] + ), + + /** Other */ + 'rainbow': ColorList('Rainbow', 'diverging', + '', + [ 0x3361E1, 0x35A845, 0xF9FF00, 0xEC8711, 0xBF2222 ] + ), + 'red-white-blue': ColorList('Red-White-Blue', 'diverging', + '', + [ 0xBF2222, 0xFFFFFF, 0x3361E1 ] + ), +} + +export type ColorListName = keyof typeof ColorLists +export const ColorListNames = Object.keys(ColorLists) +export const ColorListOptions = ColorListNames.map(n => [n, ColorLists[n as ColorListName].label] as [ColorListName, string]) + +export const ColorListOptionsScale = ColorListOptions.filter(v => ColorLists[v[0]].type === 'diverging' || ColorLists[v[0]].type === 'sequential') +export const ColorListOptionsSet = ColorListOptions.filter(v => ColorLists[v[0]].type === 'qualitative') + +export function getColorListFromName(name: ColorListName) { + if (name in ColorLists) return ColorLists[name as ColorListName].list + console.warn(`unknown color list named '${name}'`) + return ColorLists['red-yellow-blue'].list +} diff --git a/src/mol-util/color/names.ts b/src/mol-util/color/names.ts new file mode 100644 index 0000000000000000000000000000000000000000..83730283e240fea8d448b2195423248de23fd4e1 --- /dev/null +++ b/src/mol-util/color/names.ts @@ -0,0 +1,175 @@ +/** + * Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +import { ColorMap, Color } from './color'; + +/** X11 color names http://www.w3.org/TR/css3-color/#svg-color */ +export const ColorNames = ColorMap({ + aliceblue: 0xf0f8ff, + antiquewhite: 0xfaebd7, + aqua: 0x00ffff, + aquamarine: 0x7fffd4, + azure: 0xf0ffff, + beige: 0xf5f5dc, + bisque: 0xffe4c4, + black: 0x000000, + blanchedalmond: 0xffebcd, + blue: 0x0000ff, + blueviolet: 0x8a2be2, + brown: 0xa52a2a, + burlywood: 0xdeb887, + cadetblue: 0x5f9ea0, + chartreuse: 0x7fff00, + chocolate: 0xd2691e, + coral: 0xff7f50, + cornflower: 0x6495ed, + cornflowerblue: 0x6495ed, + cornsilk: 0xfff8dc, + crimson: 0xdc143c, + cyan: 0x00ffff, + darkblue: 0x00008b, + darkcyan: 0x008b8b, + darkgoldenrod: 0xb8860b, + darkgray: 0xa9a9a9, + darkgreen: 0x006400, + darkgrey: 0xa9a9a9, + darkkhaki: 0xbdb76b, + darkmagenta: 0x8b008b, + darkolivegreen: 0x556b2f, + darkorange: 0xff8c00, + darkorchid: 0x9932cc, + darkred: 0x8b0000, + darksalmon: 0xe9967a, + darkseagreen: 0x8fbc8f, + darkslateblue: 0x483d8b, + darkslategray: 0x2f4f4f, + darkslategrey: 0x2f4f4f, + darkturquoise: 0x00ced1, + darkviolet: 0x9400d3, + deeppink: 0xff1493, + deepskyblue: 0x00bfff, + dimgray: 0x696969, + dimgrey: 0x696969, + dodgerblue: 0x1e90ff, + firebrick: 0xb22222, + floralwhite: 0xfffaf0, + forestgreen: 0x228b22, + fuchsia: 0xff00ff, + gainsboro: 0xdcdcdc, + ghostwhite: 0xf8f8ff, + gold: 0xffd700, + goldenrod: 0xdaa520, + gray: 0x808080, + green: 0x008000, + greenyellow: 0xadff2f, + grey: 0x808080, + honeydew: 0xf0fff0, + hotpink: 0xff69b4, + indianred: 0xcd5c5c, + indigo: 0x4b0082, + ivory: 0xfffff0, + khaki: 0xf0e68c, + laserlemon: 0xffff54, + lavender: 0xe6e6fa, + lavenderblush: 0xfff0f5, + lawngreen: 0x7cfc00, + lemonchiffon: 0xfffacd, + lightblue: 0xadd8e6, + lightcoral: 0xf08080, + lightcyan: 0xe0ffff, + lightgoldenrod: 0xfafad2, + lightgoldenrodyellow: 0xfafad2, + lightgray: 0xd3d3d3, + lightgreen: 0x90ee90, + lightgrey: 0xd3d3d3, + lightpink: 0xffb6c1, + lightsalmon: 0xffa07a, + lightseagreen: 0x20b2aa, + lightskyblue: 0x87cefa, + lightslategray: 0x778899, + lightslategrey: 0x778899, + lightsteelblue: 0xb0c4de, + lightyellow: 0xffffe0, + lime: 0x00ff00, + limegreen: 0x32cd32, + linen: 0xfaf0e6, + magenta: 0xff00ff, + maroon: 0x800000, + maroon2: 0x7f0000, + maroon3: 0xb03060, + mediumaquamarine: 0x66cdaa, + mediumblue: 0x0000cd, + mediumorchid: 0xba55d3, + mediumpurple: 0x9370db, + mediumseagreen: 0x3cb371, + mediumslateblue: 0x7b68ee, + mediumspringgreen: 0x00fa9a, + mediumturquoise: 0x48d1cc, + mediumvioletred: 0xc71585, + midnightblue: 0x191970, + mintcream: 0xf5fffa, + mistyrose: 0xffe4e1, + moccasin: 0xffe4b5, + navajowhite: 0xffdead, + navy: 0x000080, + oldlace: 0xfdf5e6, + olive: 0x808000, + olivedrab: 0x6b8e23, + orange: 0xffa500, + orangered: 0xff4500, + orchid: 0xda70d6, + palegoldenrod: 0xeee8aa, + palegreen: 0x98fb98, + paleturquoise: 0xafeeee, + palevioletred: 0xdb7093, + papayawhip: 0xffefd5, + peachpuff: 0xffdab9, + peru: 0xcd853f, + pink: 0xffc0cb, + plum: 0xdda0dd, + powderblue: 0xb0e0e6, + purple: 0x800080, + purple2: 0x7f007f, + purple3: 0xa020f0, + rebeccapurple: 0x663399, + red: 0xff0000, + rosybrown: 0xbc8f8f, + royalblue: 0x4169e1, + saddlebrown: 0x8b4513, + salmon: 0xfa8072, + sandybrown: 0xf4a460, + seagreen: 0x2e8b57, + seashell: 0xfff5ee, + sienna: 0xa0522d, + silver: 0xc0c0c0, + skyblue: 0x87ceeb, + slateblue: 0x6a5acd, + slategray: 0x708090, + slategrey: 0x708090, + snow: 0xfffafa, + springgreen: 0x00ff7f, + steelblue: 0x4682b4, + tan: 0xd2b48c, + teal: 0x008080, + thistle: 0xd8bfd8, + tomato: 0xff6347, + turquoise: 0x40e0d0, + violet: 0xee82ee, + wheat: 0xf5deb3, + white: 0xffffff, + whitesmoke: 0xf5f5f5, + yellow: 0xffff00, + yellowgreen: 0x9acd32 +}) +export type ColorNames = typeof ColorNames +export type ColorName = keyof ColorNames +export const ColorNamesValueMap = (function() { + const map = new Map<Color, ColorName>() + Object.keys(ColorNames).forEach(name => { + map.set(ColorNames[name as ColorName], name as ColorName) + }) + return map +})() diff --git a/src/mol-util/color/scale.ts b/src/mol-util/color/scale.ts index 98160478294e81f0a9dac45287c0cfaf758e0e59..0cf4c5b39a19e50c2eccc7e189034e88b450e943 100644 --- a/src/mol-util/color/scale.ts +++ b/src/mol-util/color/scale.ts @@ -1,36 +1,14 @@ /** - * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. + * Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose <alexander.rose@weirdbyte.de> */ import { Color } from './color' -import { ColorBrewer, ColorMatplotlib, ColorOther } from './tables' +import { getColorListFromName, ColorListName } from './lists' import { defaults } from '../../mol-util'; import { NumberArray } from '../../mol-util/type-helpers'; -export type ColorListName = ( - keyof typeof ColorBrewer | keyof typeof ColorMatplotlib | keyof typeof ColorOther -) -export const ColorListNames = [ - ...Object.keys(ColorBrewer), ...Object.keys(ColorMatplotlib), ...Object.keys(ColorOther) -] -export const ColorListOptions = ColorListNames.map(n => [n, n] as [ColorListName, string]) - -export function getColorListFromName(name: ColorListName) { - if (name in ColorBrewer) { - return ColorBrewer[name as keyof typeof ColorBrewer] - } else if (name in ColorMatplotlib) { - return ColorMatplotlib[name as keyof typeof ColorMatplotlib] - } else if (name in ColorOther) { - return ColorOther[name as keyof typeof ColorOther] - } - console.warn(`unknown color list named '${name}'`) - return ColorBrewer.RedYellowBlue -} - -// - export interface ScaleLegend { kind: 'scale-legend' minLabel: string, @@ -57,7 +35,7 @@ export interface ColorScale { export const DefaultColorScaleProps = { domain: [0, 1] as [number, number], reverse: false, - listOrName: ColorBrewer.RedYellowBlue as Color[] | ColorListName, + listOrName: 'red-yellow-blue' as Color[] | ColorListName, minLabel: '' as string | undefined, maxLabel: '' as string | undefined, } diff --git a/src/mol-util/color/tables.ts b/src/mol-util/color/tables.ts deleted file mode 100644 index a42308b380646430b61fc0272ac9c0c90a2bd35a..0000000000000000000000000000000000000000 --- a/src/mol-util/color/tables.ts +++ /dev/null @@ -1,270 +0,0 @@ -/** - * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. - * - * @author Alexander Rose <alexander.rose@weirdbyte.de> - */ - -import { ColorMap, ColorTable, Color } from './color'; - -export interface TableLegend { - kind: 'table-legend' - table: [ string, Color ][] -} -export function TableLegend(table: [ string, Color ][]): TableLegend { - return { kind: 'table-legend', table } -} - -/** - * Brewer Color Lists - * - * Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University. - * Licensed under the Apache License, Version 2.0 (the "License"); - */ -export const ColorBrewer = ColorTable({ - // sequential - OrangeRed: [0xfff7ec, 0xfee8c8, 0xfdd49e, 0xfdbb84, 0xfc8d59, 0xef6548, 0xd7301f, 0xb30000, 0x7f0000], - PurpleBlue: [0xfff7fb, 0xece7f2, 0xd0d1e6, 0xa6bddb, 0x74a9cf, 0x3690c0, 0x0570b0, 0x045a8d, 0x023858], - BluePurple: [0xf7fcfd, 0xe0ecf4, 0xbfd3e6, 0x9ebcda, 0x8c96c6, 0x8c6bb1, 0x88419d, 0x810f7c, 0x4d004b], - Oranges: [0xfff5eb, 0xfee6ce, 0xfdd0a2, 0xfdae6b, 0xfd8d3c, 0xf16913, 0xd94801, 0xa63603, 0x7f2704], - BlueGreen: [0xf7fcfd, 0xe5f5f9, 0xccece6, 0x99d8c9, 0x66c2a4, 0x41ae76, 0x238b45, 0x006d2c, 0x00441b], - YellowOrangeBrown: [0xffffe5, 0xfff7bc, 0xfee391, 0xfec44f, 0xfe9929, 0xec7014, 0xcc4c02, 0x993404, 0x662506], - YellowGreen: [0xffffe5, 0xf7fcb9, 0xd9f0a3, 0xaddd8e, 0x78c679, 0x41ab5d, 0x238443, 0x006837, 0x004529], - Reds: [0xfff5f0, 0xfee0d2, 0xfcbba1, 0xfc9272, 0xfb6a4a, 0xef3b2c, 0xcb181d, 0xa50f15, 0x67000d], - RedPurple: [0xfff7f3, 0xfde0dd, 0xfcc5c0, 0xfa9fb5, 0xf768a1, 0xdd3497, 0xae017e, 0x7a0177, 0x49006a], - Greens: [0xf7fcf5, 0xe5f5e0, 0xc7e9c0, 0xa1d99b, 0x74c476, 0x41ab5d, 0x238b45, 0x006d2c, 0x00441b], - YellowGreenBlue: [0xffffd9, 0xedf8b1, 0xc7e9b4, 0x7fcdbb, 0x41b6c4, 0x1d91c0, 0x225ea8, 0x253494, 0x081d58], - Purples: [0xfcfbfd, 0xefedf5, 0xdadaeb, 0xbcbddc, 0x9e9ac8, 0x807dba, 0x6a51a3, 0x54278f, 0x3f007d], - GreenBlue: [0xf7fcf0, 0xe0f3db, 0xccebc5, 0xa8ddb5, 0x7bccc4, 0x4eb3d3, 0x2b8cbe, 0x0868ac, 0x084081], - Greys: [0xffffff, 0xf0f0f0, 0xd9d9d9, 0xbdbdbd, 0x969696, 0x737373, 0x525252, 0x252525, 0x000000], - YellowOrangeRed: [0xffffcc, 0xffeda0, 0xfed976, 0xfeb24c, 0xfd8d3c, 0xfc4e2a, 0xe31a1c, 0xbd0026, 0x800026], - PurpleRed: [0xf7f4f9, 0xe7e1ef, 0xd4b9da, 0xc994c7, 0xdf65b0, 0xe7298a, 0xce1256, 0x980043, 0x67001f], - Blues: [0xf7fbff, 0xdeebf7, 0xc6dbef, 0x9ecae1, 0x6baed6, 0x4292c6, 0x2171b5, 0x08519c, 0x08306b], - PurpleBlueGreen: [0xfff7fb, 0xece2f0, 0xd0d1e6, 0xa6bddb, 0x67a9cf, 0x3690c0, 0x02818a, 0x016c59, 0x014636], - - // diverging - Spectral: [0x9e0142, 0xd53e4f, 0xf46d43, 0xfdae61, 0xfee08b, 0xffffbf, 0xe6f598, 0xabdda4, 0x66c2a5, 0x3288bd, 0x5e4fa2], - RedYellowGreen: [0xa50026, 0xd73027, 0xf46d43, 0xfdae61, 0xfee08b, 0xffffbf, 0xd9ef8b, 0xa6d96a, 0x66bd63, 0x1a9850, 0x006837], - RedBlue: [0x67001f, 0xb2182b, 0xd6604d, 0xf4a582, 0xfddbc7, 0xf7f7f7, 0xd1e5f0, 0x92c5de, 0x4393c3, 0x2166ac, 0x053061], - PinkYellowGreen: [0x8e0152, 0xc51b7d, 0xde77ae, 0xf1b6da, 0xfde0ef, 0xf7f7f7, 0xe6f5d0, 0xb8e186, 0x7fbc41, 0x4d9221, 0x276419], - PurpleGreen: [0x40004b, 0x762a83, 0x9970ab, 0xc2a5cf, 0xe7d4e8, 0xf7f7f7, 0xd9f0d3, 0xa6dba0, 0x5aae61, 0x1b7837, 0x00441b], - RedYellowBlue: [0xa50026, 0xd73027, 0xf46d43, 0xfdae61, 0xfee090, 0xffffbf, 0xe0f3f8, 0xabd9e9, 0x74add1, 0x4575b4, 0x313695], - BrownWhiteGreen: [0x543005, 0x8c510a, 0xbf812d, 0xdfc27d, 0xf6e8c3, 0xf5f5f5, 0xc7eae5, 0x80cdc1, 0x35978f, 0x01665e, 0x003c30], - RedGrey: [0x67001f, 0xb2182b, 0xd6604d, 0xf4a582, 0xfddbc7, 0xffffff, 0xe0e0e0, 0xbababa, 0x878787, 0x4d4d4d, 0x1a1a1a], - PurpleOrange: [0x7f3b08, 0xb35806, 0xe08214, 0xfdb863, 0xfee0b6, 0xf7f7f7, 0xd8daeb, 0xb2abd2, 0x8073ac, 0x542788, 0x2d004b], - - // qualitative - Set2: [0x66c2a5, 0xfc8d62, 0x8da0cb, 0xe78ac3, 0xa6d854, 0xffd92f, 0xe5c494, 0xb3b3b3], - Accent: [0x7fc97f, 0xbeaed4, 0xfdc086, 0xffff99, 0x386cb0, 0xf0027f, 0xbf5b17, 0x666666], - Set1: [0xe41a1c, 0x377eb8, 0x4daf4a, 0x984ea3, 0xff7f00, 0xffff33, 0xa65628, 0xf781bf, 0x999999], - Set3: [0x8dd3c7, 0xffffb3, 0xbebada, 0xfb8072, 0x80b1d3, 0xfdb462, 0xb3de69, 0xfccde5, 0xd9d9d9, 0xbc80bd, 0xccebc5, 0xffed6f], - Dark2: [0x1b9e77, 0xd95f02, 0x7570b3, 0xe7298a, 0x66a61e, 0xe6ab02, 0xa6761d, 0x666666], - Paired: [0xa6cee3, 0x1f78b4, 0xb2df8a, 0x33a02c, 0xfb9a99, 0xe31a1c, 0xfdbf6f, 0xff7f00, 0xcab2d6, 0x6a3d9a, 0xffff99, 0xb15928], - Pastel2: [0xb3e2cd, 0xfdcdac, 0xcbd5e8, 0xf4cae4, 0xe6f5c9, 0xfff2ae, 0xf1e2cc, 0xcccccc], - Pastel1: [0xfbb4ae, 0xb3cde3, 0xccebc5, 0xdecbe4, 0xfed9a6, 0xffffcc, 0xe5d8bd, 0xfddaec, 0xf2f2f2] -}) - -/** - * Matplotlib colormaps, including various perceptually uniform shades, see https://bids.github.io/colormap/ - */ -export const ColorMatplotlib = ColorTable({ - /** perceptually uniform shades of black-red-white */ - Magma: [ - 0x420f74, 0x4a1079, 0x52127c, 0x5a157e, 0x61187f, 0x691c80, 0x711f81, 0x792281, 0x812581, 0x892881, 0x912a80, 0x992d7f, 0xa12f7e, 0xa9327c, 0xb1357a, 0xb93778, 0xc23a75, 0xca3e72, 0xd1426e, 0xd9466a, 0xe04b66, 0xe65162, 0xec585f, 0xf0605d, 0xf4685b, 0xf7715b, 0xf97b5d, 0xfb8460, 0xfc8e63, 0xfd9768, 0xfda16e, 0xfeaa74, 0xfeb37b, 0xfebc82, 0xfec689, 0xfdcf92, 0xfdd89a, 0xfde1a3, 0xfceaac, 0xfcf3b5, 0xfbfcbf - ], - /** perceptually uniform shades of black-red-yellow */ - Inferno: [ - 0x480b6a, 0x500d6c, 0x58106d, 0x60136e, 0x68166e, 0x70196e, 0x781c6d, 0x801f6b, 0x88216a, 0x902468, 0x982765, 0xa02a62, 0xa72d5f, 0xaf315b, 0xb73456, 0xbe3852, 0xc53d4d, 0xcc4148, 0xd24742, 0xd94d3d, 0xde5337, 0xe45a31, 0xe8612b, 0xed6825, 0xf0701e, 0xf37918, 0xf68111, 0xf88a0b, 0xfa9306, 0xfb9d06, 0xfba60b, 0xfbb014, 0xfbb91e, 0xf9c32a, 0xf8cd37, 0xf5d745, 0xf3e056, 0xf1e968, 0xf1f27d, 0xf5f891, 0xfcfea4 - ], - /** perceptually uniform shades of blue-red-yellow */ - Plasma: [ - 0x1b068c, 0x250591, 0x2f0495, 0x380499, 0x40039c, 0x49029f, 0x5101a2, 0x5901a4, 0x6100a6, 0x6800a7, 0x7000a8, 0x7801a8, 0x7f03a7, 0x8607a6, 0x8e0ca4, 0x9511a1, 0x9b179e, 0xa21c9a, 0xa82296, 0xae2791, 0xb42d8d, 0xb93388, 0xbe3883, 0xc33e7f, 0xc8447a, 0xcd4975, 0xd14f71, 0xd6556d, 0xda5a68, 0xde6064, 0xe26660, 0xe56c5b, 0xe97257, 0xec7853, 0xef7e4e, 0xf2854a, 0xf58b46, 0xf79241, 0xf9993d, 0xfaa039, 0xfca735, 0xfdaf31, 0xfdb62d, 0xfdbe29, 0xfdc626, 0xfcce25, 0xfad624, 0xf8df24, 0xf5e726, 0xf2f026, 0xeff821 - ], - /** perceptually uniform shades of blue-green-yellow */ - Viridis: [ - 0x45085b, 0x470f62, 0x471669, 0x481d6f, 0x482374, 0x472a79, 0x46307d, 0x453681, 0x433c84, 0x414286, 0x3e4888, 0x3c4d8a, 0x3a538b, 0x37588c, 0x355d8c, 0x32628d, 0x30678d, 0x2e6c8e, 0x2c718e, 0x2a768e, 0x287a8e, 0x267f8e, 0x24848d, 0x23898d, 0x218d8c, 0x1f928c, 0x1e978a, 0x1e9b89, 0x1ea087, 0x20a585, 0x23a982, 0x28ae7f, 0x2eb27c, 0x35b778, 0x3dbb74, 0x45bf6f, 0x4fc369, 0x59c764, 0x64cb5d, 0x70ce56, 0x7cd24f, 0x88d547, 0x95d73f, 0xa2da37, 0xafdc2e, 0xbdde26, 0xcae01e, 0xd7e219, 0xe4e318, 0xf1e51c, 0xfde724 - ], - /** - * perceptually uniform shades of blue-green-yellow, - * should look effectively identical to colorblind and non-colorblind users - */ - Cividis: [ - 0x002c67, 0x003070, 0x083370, 0x16366f, 0x1f3a6e, 0x273d6d, 0x2e416c, 0x34446c, 0x39486c, 0x3f4b6b, 0x444f6b, 0x49526b, 0x4e566c, 0x52596c, 0x575d6d, 0x5b606e, 0x60646e, 0x64676f, 0x686b71, 0x6d6e72, 0x717273, 0x757575, 0x797977, 0x7e7d78, 0x838078, 0x878478, 0x8c8878, 0x918c77, 0x968f77, 0x9b9376, 0xa09775, 0xa59b73, 0xaa9f72, 0xafa370, 0xb4a76f, 0xb9ab6d, 0xbeb06a, 0xc4b468, 0xc9b865, 0xcebc62, 0xd4c15e, 0xd9c55a, 0xdfca56, 0xe4ce51, 0xead34c, 0xefd846, 0xf5dc3f, 0xfbe136, 0xfde737 - ], - /** perceptually uniform shades of white-blue-black-red-white, cyclic */ - Twilight: [ - 0xdfd9e1, 0xd8d7dd, 0xced3d8, 0xc2cdd3, 0xb4c7ce, 0xa7c0ca, 0x9ab8c7, 0x8eb0c5, 0x83a8c3, 0x7a9fc2, 0x7297c0, 0x6b8ebf, 0x6684bd, 0x637bbb, 0x6171b9, 0x5f67b6, 0x5e5cb2, 0x5e51ad, 0x5d46a7, 0x5c3c9f, 0x5b3196, 0x58278b, 0x531e7d, 0x4d176e, 0x46135f, 0x3e1151, 0x381045, 0x32113b, 0x301336, 0x361138, 0x3e113c, 0x471240, 0x521445, 0x5e1749, 0x6a1a4d, 0x761e4f, 0x812350, 0x8b2a50, 0x95324f, 0x9d3a4f, 0xa5434f, 0xac4d50, 0xb25752, 0xb86155, 0xbc6c59, 0xc0775f, 0xc48267, 0xc78d70, 0xc9987b, 0xcca389, 0xceae97, 0xd2b8a6, 0xd6c1b5, 0xdacac4, 0xddd1d1, 0xe0d6db, 0xe1d8e1 - ] -}) - -export const ColorOther = ColorTable({ - Rainbow: [ 0x3361E1, 0x35A845, 0xF9FF00, 0xEC8711, 0xBF2222 ], - RedWhiteBlue: [ 0xBF2222, 0xFFFFFF, 0x3361E1 ], -}) - -/** X11 color names http://www.w3.org/TR/css3-color/#svg-color */ -export const ColorNames = ColorMap({ - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflower: 0x6495ed, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkgrey: 0xa9a9a9, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - grey: 0x808080, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - laserlemon: 0xffff54, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrod: 0xfafad2, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - maroon2: 0x7f0000, - maroon3: 0xb03060, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - purple2: 0x7f007f, - purple3: 0xa020f0, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32 -}) -export type ColorNames = typeof ColorNames -export type ColorName = keyof ColorNames -export const ColorNamesValueMap = (function() { - const map = new Map<Color, ColorName>() - Object.keys(ColorNames).forEach(name => { - map.set(ColorNames[name as ColorName], name as ColorName) - }) - return map -})() diff --git a/src/tests/browser/marching-cubes.ts b/src/tests/browser/marching-cubes.ts index 2e71abe29a857c9babdcee7d354ee6c896069a4d..7aacd5ac46f82f418a49cf76fcfe1aadc26b1e5e 100644 --- a/src/tests/browser/marching-cubes.ts +++ b/src/tests/browser/marching-cubes.ts @@ -8,7 +8,7 @@ import './index.html' import { resizeCanvas } from '../../mol-canvas3d/util'; import { Canvas3D } from '../../mol-canvas3d/canvas3d'; import { RendererParams } from '../../mol-gl/renderer'; -import { ColorNames } from '../../mol-util/color/tables'; +import { ColorNames } from '../../mol-util/color/names'; import { PositionData, Box3D, Sphere3D } from '../../mol-math/geometry'; import { OrderedSet } from '../../mol-data/int'; import { Vec3 } from '../../mol-math/linear-algebra'; diff --git a/src/tests/browser/render-asa.ts b/src/tests/browser/render-asa.ts index 2115143d0b17cee635ae622cfce95e46178bf7af..b877965e8861bb8f0dae187f49d368793b727d99 100644 --- a/src/tests/browser/render-asa.ts +++ b/src/tests/browser/render-asa.ts @@ -15,7 +15,7 @@ import { SizeTheme } from '../../mol-theme/size'; import { CartoonRepresentationProvider } from '../../mol-repr/structure/representation/cartoon'; import { AccessibleSurfaceArea } from '../../mol-model/structure/structure/accessible-surface-area'; import { Color, ColorScale } from '../../mol-util/color'; -import { ColorListName, ColorListOptions } from '../../mol-util/color/scale'; +import { ColorListName, ColorListOptions } from '../../mol-util/color/lists'; import { ThemeDataContext } from '../../mol-theme/theme'; import { ParamDefinition as PD } from '../../mol-util/param-definition'; import { Location } from '../../mol-model/location'; @@ -101,7 +101,7 @@ const DefaultColor = Color(0xFFFFFF) const Description = 'Assigns a color based on the relative accessible surface area of a residue.' export const AccessibleSurfaceAreaColorThemeParams = { - list: PD.ColorScale<ColorListName>('Rainbow', ColorListOptions) + list: PD.ColorScale<ColorListName>('rainbow', ColorListOptions) } export type AccessibleSurfaceAreaColorThemeParams = typeof AccessibleSurfaceAreaColorThemeParams export function getAccessibleSurfaceAreaColorThemeParams(ctx: ThemeDataContext) { diff --git a/src/tests/browser/render-shape.ts b/src/tests/browser/render-shape.ts index ff1039952f4fddea97d845632f306d4b95e70c16..d06d257ce4dd1e1dd4a434015d84617df3948d20 100644 --- a/src/tests/browser/render-shape.ts +++ b/src/tests/browser/render-shape.ts @@ -16,7 +16,7 @@ import { Mesh } from '../../mol-geo/geometry/mesh/mesh'; import { MeshBuilder } from '../../mol-geo/geometry/mesh/mesh-builder'; import { Mat4, Vec3 } from '../../mol-math/linear-algebra'; import { Sphere } from '../../mol-geo/primitive/sphere'; -import { ColorNames } from '../../mol-util/color/tables'; +import { ColorNames } from '../../mol-util/color/names'; import { Shape } from '../../mol-model/shape'; import { ShapeRepresentation } from '../../mol-repr/shape/representation';