(fullCode)
| 859 | } |
| 860 | |
| 861 | function extractShortCode(fullCode) { |
| 862 | if (!fullCode) return ''; |
| 863 | // Extract numeric part after letter prefix (P01→1, H01→1, S199→199) |
| 864 | const match = fullCode.match(/([A-Za-z]*)(\d+)/); |
| 865 | if (match) { |
| 866 | return String(parseInt(match[2], 10)); |
| 867 | } |
| 868 | return fullCode; |
| 869 | } |
| 870 | |
| 871 | function getContrastColor(r, g, b) { |
| 872 | const yiq = (r * 299 + g * 587 + b * 114) / 1000; |