From 93c7b8dea7d73754488b8f7369cb90c0c4ad6064 Mon Sep 17 00:00:00 2001 From: Adorian Doran Date: Sat, 18 Oct 2025 21:22:55 +0300 Subject: [PATCH] client: fix the issues pointed by gemini-code-assist --- apps/client/package.json | 1 + apps/client/src/services/css_class_manager.ts | 9 ++++++--- apps/client/src/utils/css-var.ts | 2 +- apps/server/package.json | 1 - pnpm-lock.yaml | 10 +++++----- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/client/package.json b/apps/client/package.json index 4459d2cb2..dceb6e8b8 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -35,6 +35,7 @@ "autocomplete.js": "0.38.1", "bootstrap": "5.3.8", "boxicons": "2.1.4", + "color": "5.0.2", "dayjs": "1.11.18", "dayjs-plugin-utc": "0.1.2", "debounce": "2.2.0", diff --git a/apps/client/src/services/css_class_manager.ts b/apps/client/src/services/css_class_manager.ts index 6c26b5dcb..3b7f8ce1f 100644 --- a/apps/client/src/services/css_class_manager.ts +++ b/apps/client/src/services/css_class_manager.ts @@ -62,10 +62,13 @@ function adjustColorLightness(color: string, lightThemeMaxLightness: number, dar return; } + const lightness = labColor.l(); + // For the light theme, limit the maximum lightness - const lightThemeColor = labColor.l(Math.min(labColor.l(), lightThemeMaxLightness)).hex(); - // For the light theme, limit the minimum lightness - const darkThemeColor = labColor.l(Math.max(labColor.l(), darkThemeMinLightness)).hex(); + const lightThemeColor = labColor.l(Math.min(lightness, lightThemeMaxLightness)).hex(); + + // For the dark theme, limit the minimum lightness + const darkThemeColor = labColor.l(Math.max(lightness, darkThemeMinLightness)).hex(); return {lightThemeColor, darkThemeColor}; } diff --git a/apps/client/src/utils/css-var.ts b/apps/client/src/utils/css-var.ts index a0a16402f..886247881 100644 --- a/apps/client/src/utils/css-var.ts +++ b/apps/client/src/utils/css-var.ts @@ -17,7 +17,7 @@ export class CssVarReader { let number: Number = NaN; if (this.value) { - number = new Number(this.value); + number = parseFloat(this.value); } return (!isNaN(number.valueOf()) ? number.valueOf() : defaultValue) diff --git a/apps/server/package.json b/apps/server/package.json index f16ea110a..aff4901b2 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -26,7 +26,6 @@ }, "dependencies": { "better-sqlite3": "12.4.1", - "color": "5.0.2", "node-html-parser": "7.0.1" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5b8c5382c..77e4d877e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -184,6 +184,9 @@ importers: boxicons: specifier: 2.1.4 version: 2.1.4 + color: + specifier: 5.0.2 + version: 5.0.2 dayjs: specifier: 1.11.18 version: 1.11.18 @@ -452,9 +455,6 @@ importers: better-sqlite3: specifier: 12.4.1 version: 12.4.1 - color: - specifier: 5.0.2 - version: 5.0.2 node-html-parser: specifier: 7.0.1 version: 7.0.1 @@ -14901,8 +14901,6 @@ snapshots: '@ckeditor/ckeditor5-utils': 47.1.0 '@ckeditor/ckeditor5-watchdog': 47.1.0 es-toolkit: 1.39.5 - transitivePeerDependencies: - - supports-color '@ckeditor/ckeditor5-dev-build-tools@43.1.0(@swc/helpers@0.5.17)(tslib@2.8.1)(typescript@5.9.3)': dependencies: @@ -15680,6 +15678,8 @@ snapshots: '@ckeditor/ckeditor5-ui': 47.1.0 '@ckeditor/ckeditor5-utils': 47.1.0 ckeditor5: 47.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41) + transitivePeerDependencies: + - supports-color '@ckeditor/ckeditor5-special-characters@47.1.0': dependencies: