// Checks if a string is a valid RGB color.
export function isRgbColor(color: string): boolean {
  // Check if the color starts with 'rgb(' and ends with ')'
  if (!color.startsWith('rgb(') || !color.endsWith(')')) {
    return false;
  }

  // Remove 'rgb(' and ')' from the color string
  const rgb = color.slice(4, -1);

  // Split the color string by commas
  const values = rgb.split(',');

  // Check if the color has exactly 3 values
  if (values.length !== 3) {
    return false;
  }

  // Check if each value is a valid number between 0 and 255
  for (const value of values) {
    const num = Number(value.trim());
    if (isNaN(num) || num < 0 || num > 255) {
      return false;
    }
  }

  return true;
}
