(color)
| 923 | |
| 924 | // 获取颜色亮度 |
| 925 | function getColorBrightness(color) { |
| 926 | // 处理rgb格式 |
| 927 | if (color.startsWith('rgb(')) { |
| 928 | const parts = color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/); |
| 929 | if (parts) { |
| 930 | const r = parseInt(parts[1]); |
| 931 | const g = parseInt(parts[2]); |
| 932 | const b = parseInt(parts[3]); |
| 933 | // 计算亮度 (根据人眼对RGB的敏感度加权) |
| 934 | return (r * 0.299 + g * 0.587 + b * 0.114) / 255; |
| 935 | } |
| 936 | } |
| 937 | |
| 938 | // 默认返回0.5 |
| 939 | return 0.5; |
| 940 | } |
| 941 | |
| 942 | // 获取热力图颜色 |
| 943 | function getHeatmapColor(value) { |