shape-group.ts 725 B

123456789101112131415161718192021222324
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { ColorTheme, ColorThemeProps } from '../color';
  7. import { Color } from 'mol-util/color';
  8. import { Location } from 'mol-model/location';
  9. import { Shape } from 'mol-model/shape';
  10. const DefaultColor = 0xCCCCCC as Color
  11. export function ShapeGroupColorTheme(props: ColorThemeProps): ColorTheme {
  12. return {
  13. kind: 'group',
  14. color: (location: Location): Color => {
  15. if (Shape.isLocation(location)) {
  16. return location.shape.colors.ref.value[location.group]
  17. }
  18. return DefaultColor
  19. }
  20. }
  21. }