* Calculate heat color for given intensity (0-1) * Hot spans (>30%) get warm orange, cold spans get dimmed gray * @param {number} intensity - Value between 0 and 1 * @returns {string} rgba color string
(intensity)
| 323 | * @returns {string} rgba color string |
| 324 | */ |
| 325 | function calculateHeatColor(intensity) { |
| 326 | // Hot threshold: only spans with >30% of max samples get color |
| 327 | if (intensity > 0.3) { |
| 328 | // Normalize intensity above threshold to 0-1 |
| 329 | const normalizedIntensity = (intensity - 0.3) / 0.7; |
| 330 | // Warm orange-red with increasing opacity for hotter spans |
| 331 | const alpha = 0.25 + normalizedIntensity * 0.35; // 0.25 to 0.6 |
| 332 | const hotColor = getComputedStyle(document.documentElement).getPropertyValue('--span-hot-base').trim(); |
| 333 | return `rgba(${hotColor}, ${alpha})`; |
| 334 | } else if (intensity > 0) { |
| 335 | // Cold spans: very subtle gray, almost invisible |
| 336 | const coldColor = getComputedStyle(document.documentElement).getPropertyValue('--span-cold-base').trim(); |
| 337 | return `rgba(${coldColor}, 0.1)`; |
| 338 | } |
| 339 | return 'transparent'; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * Apply intensity-based heat colors to source spans |
no outgoing calls
no test coverage detected
searching dependent graphs…