All files / src/utils ciaColorUtils.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                                                              61x                                         61x    
/**
 * CIA Component Color Utilities
 *
 * Provides consistent color styling for Confidentiality, Integrity, and Availability components
 * across the application. These utilities ensure visual consistency and proper theme support.
 */
 
import type { CIAComponent } from "../types/cia";
 
export interface CIAColors {
  bg: string;
  text: string;
  border: string;
  badge: string;
}
 
/**
 * Get consistent color classes for CIA components
 *
 * @param component - The CIA component type
 * @returns Object with Tailwind color classes for different uses
 *
 * @example
 * ```typescript
 * const colors = getCIAColors('confidentiality');
 * <div className={cn(colors.bg, colors.border)}>
 *   Confidentiality Content
 * </div>
 * ```
 */
export function getCIAColors(component: CIAComponent): CIAColors {
  const colors: Record<CIAComponent, CIAColors> = {
    confidentiality: {
      bg: "bg-purple-50 dark:bg-purple-900/20",
      text: "text-purple-800 dark:text-purple-300",
      border: "border-l-4 border-purple-500 dark:border-purple-400",
      badge: "bg-purple-100 dark:bg-purple-900/30",
    },
    integrity: {
      bg: "bg-green-50 dark:bg-green-900/20",
      text: "text-green-800 dark:text-green-300",
      border: "border-l-4 border-green-500 dark:border-green-400",
      badge: "bg-green-100 dark:bg-green-900/30",
    },
    availability: {
      bg: "bg-blue-50 dark:bg-blue-900/20",
      text: "text-blue-800 dark:text-blue-300",
      border: "border-l-4 border-blue-500 dark:border-blue-400",
      badge: "bg-blue-100 dark:bg-blue-900/30",
    },
  };
 
  return colors[component];
}