Browse Source

type fixes

Alexander Rose 1 year ago
parent
commit
492494033f
2 changed files with 3 additions and 2 deletions
  1. 1 1
      src/mol-util/color/color.ts
  2. 2 1
      src/mol-util/color/distinct.ts

+ 1 - 1
src/mol-util/color/color.ts

@@ -192,7 +192,7 @@ export interface ColorList {
     type: 'sequential' | 'diverging' | 'qualitative'
 }
 export function ColorList(label: string, type: 'sequential' | 'diverging' | 'qualitative', description: string, list: (number | [number, number])[]): ColorList {
-    return { label, description, list: list as Color[], type };
+    return { label, description, list: list as ColorListEntry[], type };
 }
 
 export type ColorTable<T extends { [k: string]: number[] }> = { [k in keyof T]: Color[] }

+ 2 - 1
src/mol-util/color/distinct.ts

@@ -15,6 +15,7 @@ import { deepEqual } from '../../mol-util';
 import { arraySum } from '../../mol-util/array';
 import { ParamDefinition as PD } from '../../mol-util/param-definition';
 import { ColorNames } from './names';
+import { Color } from './color';
 
 export const DistinctColorsParams = {
     hue: PD.Interval([1, 360], { min: 0, max: 360, step: 1 }),
@@ -100,7 +101,7 @@ function getSamples(count: number, p: DistinctColorsProps) {
 /**
  * Create a list of visually distinct colors
  */
-export function distinctColors(count: number, props: Partial<DistinctColorsProps> = {}) {
+export function distinctColors(count: number, props: Partial<DistinctColorsProps> = {}): Color[] {
     const p = { ...PD.getDefaultValues(DistinctColorsParams), ...props };
 
     if (count <= 0) return [];