From e14c9ae5418088b3248c246f9f3882b9b76c3cbb Mon Sep 17 00:00:00 2001 From: Angel Wang Date: Sun, 21 Jun 2026 12:51:17 -0600 Subject: [PATCH] fix: it's LCH not HCL --- analyze/analysis.ts | 2 +- apply/application.ts | 6 ++++-- apply/index.ts | 4 +--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/analyze/analysis.ts b/analyze/analysis.ts index 1807750..65b6bd5 100755 --- a/analyze/analysis.ts +++ b/analyze/analysis.ts @@ -72,7 +72,7 @@ export async function analyzeImages(imageDir: string, analysisOutput: ImageAnaly const chroma = Number(dominantColour[1]) const hue = Number(dominantColour[2]) - analysisOutput.files.push({ path: path, oklch: [hue, chroma, lightness] }) + analysisOutput.files.push({ path: path, oklch: [lightness, chroma, hue] }) // flush every time we finish analyzing a file, because it just takes so long fs.writeFile(outputPath, JSON.stringify(analysisOutput, null, 4), (err: Error) => { diff --git a/apply/application.ts b/apply/application.ts index 5f245ec..edcb9b3 100644 --- a/apply/application.ts +++ b/apply/application.ts @@ -82,8 +82,8 @@ export function findMatchingImages( chromaValue: number, lightnessValue: number, ) { - const targetColour = [hueValue, chromaValue, lightnessValue] - let closestColour = { path: "", oklch: [-1, -1, -1] } + const targetColour = [lightnessValue, chromaValue, hueValue] + let closestColour = imagesData.files[0] for (const file of imagesData.files) { if ( @@ -94,5 +94,7 @@ export function findMatchingImages( closestColour = file } } + console.info(`Found target image ${closestColour.path} with colour oklch(${closestColour.oklch[0]} ${closestColour.oklch[1]} ${closestColour.oklch[2]})!`) + return closestColour } diff --git a/apply/index.ts b/apply/index.ts index c78329a..3eb07e4 100644 --- a/apply/index.ts +++ b/apply/index.ts @@ -53,9 +53,7 @@ const lightnessValue = map( config.lightnessRange.end, ) -console.info(`Got hue value ${hueValue}°!`) -console.info(`Got chroma value ${chromaValue}%!`) -console.info(`Got lightness value ${lightnessValue}%!`) +console.info(`Calculated target colour oklch(${lightnessValue} ${chromaValue} ${hueValue})!`) console.debug(`Trying to open cache file ${pathToCache}...`) const cacheFile = await fs.promises.readFile(`${pathToCache}`, { -- 2.51.2