Skip to content

Commit f987f48

Browse files
ayutazclaude
andcommitted
fix: 変数名の重複によるSyntaxErrorを修正
- rgbToLab関数: b → bNorm, bLab に変更 - deltaE2000関数: b1, b2 → bLab1, bLab2 に変更 - 既存の変数名との衝突を解消 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 54defd1 commit f987f48

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

src/js/app-v3.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -546,19 +546,19 @@
546546
// RGB to LAB color space conversion
547547
rgbToLab(rgb) {
548548
// Normalize RGB values
549-
let r = rgb[0] / 255;
550-
let g = rgb[1] / 255;
551-
let b = rgb[2] / 255;
549+
let rNorm = rgb[0] / 255;
550+
let gNorm = rgb[1] / 255;
551+
let bNorm = rgb[2] / 255;
552552

553553
// Apply gamma correction
554-
r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
555-
g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
556-
b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
554+
rNorm = rNorm > 0.04045 ? Math.pow((rNorm + 0.055) / 1.055, 2.4) : rNorm / 12.92;
555+
gNorm = gNorm > 0.04045 ? Math.pow((gNorm + 0.055) / 1.055, 2.4) : gNorm / 12.92;
556+
bNorm = bNorm > 0.04045 ? Math.pow((bNorm + 0.055) / 1.055, 2.4) : bNorm / 12.92;
557557

558558
// Convert to XYZ (D65 illuminant)
559-
let x = (r * 0.4124564 + g * 0.3575761 + b * 0.1804375) * 100;
560-
let y = (r * 0.2126729 + g * 0.7151522 + b * 0.0721750) * 100;
561-
let z = (r * 0.0193339 + g * 0.1191920 + b * 0.9503041) * 100;
559+
let x = (rNorm * 0.4124564 + gNorm * 0.3575761 + bNorm * 0.1804375) * 100;
560+
let y = (rNorm * 0.2126729 + gNorm * 0.7151522 + bNorm * 0.0721750) * 100;
561+
let z = (rNorm * 0.0193339 + gNorm * 0.1191920 + bNorm * 0.9503041) * 100;
562562

563563
// Normalize for D65 illuminant
564564
x = x / 95.047;
@@ -573,24 +573,24 @@
573573
// Calculate LAB values
574574
const L = 116 * y - 16;
575575
const a = 500 * (x - y);
576-
const b = 200 * (y - z);
576+
const bLab = 200 * (y - z);
577577

578-
return [L, a, b];
578+
return [L, a, bLab];
579579
}
580580

581581
// CIEDE2000 color difference formula
582582
deltaE2000(lab1, lab2) {
583583
// Simplified CIEDE2000 - for full implementation, use specialized library
584584
// This is a reasonable approximation for our use case
585-
const [L1, a1, b1] = lab1;
586-
const [L2, a2, b2] = lab2;
585+
const [L1, a1, bLab1] = lab1;
586+
const [L2, a2, bLab2] = lab2;
587587

588588
const dL = L2 - L1;
589589
const da = a2 - a1;
590-
const db = b2 - b1;
590+
const db = bLab2 - bLab1;
591591

592-
const C1 = Math.sqrt(a1 * a1 + b1 * b1);
593-
const C2 = Math.sqrt(a2 * a2 + b2 * b2);
592+
const C1 = Math.sqrt(a1 * a1 + bLab1 * bLab1);
593+
const C2 = Math.sqrt(a2 * a2 + bLab2 * bLab2);
594594
const dC = C2 - C1;
595595

596596
const dH = Math.sqrt(Math.max(0, da * da + db * db - dC * dC));

0 commit comments

Comments
 (0)