molstar
Version:
A comprehensive macromolecular library.
38 lines • 1.45 kB
JavaScript
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import { Color } from '../../mol-util/color';
import { ShapeGroup } from '../../mol-model/shape';
import { ParamDefinition as PD } from '../../mol-util/param-definition';
var DefaultColor = Color(0xCCCCCC);
var Description = 'Assigns colors as defined by the shape object.';
export var ShapeGroupColorThemeParams = {};
export function getShapeGroupColorThemeParams(ctx) {
return ShapeGroupColorThemeParams; // TODO return copy
}
export function ShapeGroupColorTheme(ctx, props) {
return {
factory: ShapeGroupColorTheme,
granularity: 'groupInstance',
color: function (location) {
if (ShapeGroup.isLocation(location)) {
return location.shape.getColor(location.group, location.instance);
}
return DefaultColor;
},
props: props,
description: Description
};
}
export var ShapeGroupColorThemeProvider = {
name: 'shape-group',
label: 'Shape Group',
category: "Miscellaneous" /* Misc */,
factory: ShapeGroupColorTheme,
getParams: getShapeGroupColorThemeParams,
defaultValues: PD.getDefaultValues(ShapeGroupColorThemeParams),
isApplicable: function (ctx) { return !!ctx.shape; }
};
//# sourceMappingURL=shape-group.js.map