(text, name)
| 755 | } |
| 756 | |
| 757 | function parseHexPalette(text, name) { |
| 758 | const lines = text.split(/\r?\n/); |
| 759 | const colors = []; |
| 760 | for (const line of lines) { |
| 761 | const trimmed = line.trim(); |
| 762 | if (!trimmed || trimmed.startsWith('#') && trimmed.length <= 1) continue; |
| 763 | const rgb = hexToRgb(trimmed); |
| 764 | if (rgb) colors.push(rgb); |
| 765 | } |
| 766 | if (colors.length < 2) throw new Error('Palette must contain at least 2 colors'); |
| 767 | return { id: name.replace(/\.[^.]+$/, ''), displayName: name.replace(/\.[^.]+$/, ''), colors }; |
| 768 | } |
| 769 | |
| 770 | function parseTxtPalette(text, name) { |
| 771 | const lines = text.split(/\r?\n/); |
no test coverage detected