fix: Changing colors in background to reflect KetaPK excel version

This commit is contained in:
gauvainboiche
2026-08-29 16:20:48 +02:00
parent 3f4b8a78fa
commit 94dfe1c26c
7 changed files with 29 additions and 36 deletions
+5 -14
View File
@@ -1,21 +1,11 @@
import { CLINICAL_THRESHOLDS } from './pkCore.js';
import { t } from './i18n.js';
// Le texte des zones cliniques (zone.textHex) est calibré pour un fond sombre.
// Sur le thème clair, il faut un texte foncé pour rester lisible sur le même fond pastel.
const LIGHT_THEME_ZONE_TEXT = {
inactive: '#854d0e',
anti_hyperalgesic: '#3f6212',
analgesia: '#92400e',
psychedelic: '#9d174d',
emergence: '#075985',
narcosis: '#1e3a8a',
excessive: '#7f1d1d'
};
// Les couleurs de zone sont volontairement fixes (indépendantes du thème d'interface) :
// elles reproduisent le dégradé de référence de l'outil KetaPK original. Seul le texte
// (zone.textHex) est choisi pour rester lisible sur cette couleur de fond opaque.
export function updateChartAnnotations(chart, mode, currentYMax) {
const thresholds = CLINICAL_THRESHOLDS[mode];
const theme = document.documentElement.getAttribute('data-theme') || 'dark';
const annotations = {};
thresholds.zones.forEach((zone, index) => {
@@ -24,6 +14,7 @@ export function updateChartAnnotations(chart, mode, currentYMax) {
annotations[`zone_${index}`] = {
type: 'box',
drawTime: 'beforeDraw',
yMin: zone.min,
yMax: Math.min(zoneMax, currentYMax),
backgroundColor: zone.color,
@@ -31,7 +22,7 @@ export function updateChartAnnotations(chart, mode, currentYMax) {
label: {
display: true,
content: t(`zones.${zone.zoneKey}`),
color: theme === 'light' ? (LIGHT_THEME_ZONE_TEXT[zone.zoneKey] || '#1e293b') : zone.textHex,
color: zone.textHex,
font: { size: 11, weight: 'bold' },
position: 'center'
}