(customTheme: Partial<CustomTheme>)
| 424 | * @returns An object with isValid boolean and error message if invalid. |
| 425 | */ |
| 426 | export function validateCustomTheme(customTheme: Partial<CustomTheme>): { |
| 427 | isValid: boolean; |
| 428 | error?: string; |
| 429 | warning?: string; |
| 430 | } { |
| 431 | // Since all fields are optional, we only need to validate the name. |
| 432 | if (customTheme.name && !isValidThemeName(customTheme.name)) { |
| 433 | return { |
| 434 | isValid: false, |
| 435 | error: `Invalid theme name: ${customTheme.name}`, |
| 436 | }; |
| 437 | } |
| 438 | |
| 439 | return { |
| 440 | isValid: true, |
| 441 | }; |
| 442 | } |
| 443 | |
| 444 | /** |
| 445 | * Checks if a theme name is valid. |
no test coverage detected