INNER CODE UNIT · TypeScript

clearColors

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

export const clearColors = (project: string, key?: string) => {
  localStorage.removeItem(`${project}/colors${key ? `/${key}` : ''}`);
};

export function generateStageColors<T extends HasMetadata>(sortedObjects: T[], prevMap?: ColorMap) {
  const curColors = { ...ColorMapHex };
  let finalMap: { [key: string]: string } = {};

  if (prevMap && Object.keys(prevMap).length > 0) {
    for (const color of Object.values(prevMap)) {
      delete curColors[color];
    }
    finalMap = { ...prevMap };
  }

  for (const stage of sortedObjects) {
    const color = parseColorAnnotation(stage);
    if (color) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…