INNER CODE UNIT · TypeScript

getColors

akuity/kargo · ui/src/features/stage/utils/index.ts:62

export function getColors<T extends HasMetadata>(
  project: string,
  objects: T[],
  key?: string
): ColorMap {
  // check local storage
  const colors = localStorage.getItem(`${project}/colors${key ? `/${key}` : ''}`);
  if (colors) {
    const m = JSON.parse(colors);
    if (Object.keys(m).length === objects.length) {
      for (const stage of objects) {
        const color = parseColorAnnotation(stage);
        if (color) {
          m[stage?.metadata?.name || ''] = ColorMapHex[color] ?? color;
        }
      }
      return m;
    } else {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…