Skip to content

Commit e9b9364

Browse files
committed
Use raw Matplotlib colors
1 parent 0eb3a49 commit e9b9364

1 file changed

Lines changed: 13 additions & 29 deletions

File tree

src/components/ChartContainer.jsx

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -190,25 +190,9 @@ export default function ChartContainer({
190190
'#17becf' // cyan
191191
];
192192

193-
const lightenColor = (hex, factor = 0.2) => {
194-
const r = parseInt(hex.slice(1, 3), 16);
195-
const g = parseInt(hex.slice(3, 5), 16);
196-
const b = parseInt(hex.slice(5, 7), 16);
197-
const nr = Math.round(r + (255 - r) * factor)
198-
.toString(16)
199-
.padStart(2, '0');
200-
const ng = Math.round(g + (255 - g) * factor)
201-
.toString(16)
202-
.padStart(2, '0');
203-
const nb = Math.round(b + (255 - b) * factor)
204-
.toString(16)
205-
.padStart(2, '0');
206-
return `#${nr}${ng}${nb}`;
207-
};
208193
const createChartData = dataArray => ({
209194
datasets: dataArray.map((item, index) => {
210-
const base = baseColors[index % baseColors.length];
211-
const color = lightenColor(base, 0.2);
195+
const color = baseColors[index % baseColors.length];
212196
return {
213197
label: item.name?.replace(/\.(log|txt)$/i, '') || `File ${index + 1}`,
214198
data: item.data,
@@ -416,18 +400,18 @@ export default function ChartContainer({
416400
{
417401
label: `${title} 差值`,
418402
data: comparisonData,
419-
borderColor: lightenColor('#d62728', 0.2),
420-
backgroundColor: lightenColor('#d62728', 0.2),
403+
borderColor: '#d62728',
404+
backgroundColor: '#d62728',
421405
borderWidth: 1.5,
422406
fill: false,
423407
tension: 0,
424408
pointRadius: 0,
425409
pointHoverRadius: 4,
426-
pointBackgroundColor: lightenColor('#d62728', 0.2),
427-
pointBorderColor: lightenColor('#d62728', 0.2),
410+
pointBackgroundColor: '#d62728',
411+
pointBorderColor: '#d62728',
428412
pointBorderWidth: 1,
429-
pointHoverBackgroundColor: lightenColor('#d62728', 0.2),
430-
pointHoverBorderColor: lightenColor('#d62728', 0.2),
413+
pointHoverBackgroundColor: '#d62728',
414+
pointHoverBorderColor: '#d62728',
431415
pointHoverBorderWidth: 1,
432416
animation: false,
433417
animations: { colors: false, x: false, y: false },
@@ -438,19 +422,19 @@ export default function ChartContainer({
438422
datasets.push({
439423
label: 'Baseline',
440424
data: baselineData,
441-
borderColor: lightenColor('#17becf', 0.2),
442-
backgroundColor: lightenColor('#17becf', 0.2),
425+
borderColor: '#17becf',
426+
backgroundColor: '#17becf',
443427
borderWidth: 1.5,
444428
borderDash: [5, 5],
445429
fill: false,
446430
tension: 0,
447431
pointRadius: 0,
448432
pointHoverRadius: 4,
449-
pointBackgroundColor: lightenColor('#17becf', 0.2),
450-
pointBorderColor: lightenColor('#17becf', 0.2),
433+
pointBackgroundColor: '#17becf',
434+
pointBorderColor: '#17becf',
451435
pointBorderWidth: 1,
452-
pointHoverBackgroundColor: lightenColor('#17becf', 0.2),
453-
pointHoverBorderColor: lightenColor('#17becf', 0.2),
436+
pointHoverBackgroundColor: '#17becf',
437+
pointHoverBorderColor: '#17becf',
454438
pointHoverBorderWidth: 1,
455439
animation: false,
456440
animations: { colors: false, x: false, y: false },

0 commit comments

Comments
 (0)