Skip to content

Commit 508f445

Browse files
Update src/utils/color
1 parent 89e8f72 commit 508f445

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/minimal-shared/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# minimal-shared
22

3-
## 1.0.12
3+
## 1.0.14
44

55
_Jun 10, 2025_
66

packages/minimal-shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "minimal-shared",
33
"author": "Minimals",
4-
"version": "1.0.12",
4+
"version": "1.0.14",
55
"description": "Shared hooks and utils used by Minimal UI and Zone UI.",
66
"keywords": [
77
"typescript",

packages/minimal-shared/src/utils/color/color.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function validateOpacity(opacity: string | number, color: string): string {
9999
const isPercentage = (val: string) => val.trim().endsWith('%');
100100

101101
const errors = {
102-
invalid: `[varAlphaX]: Invalid opacity "${opacity}" for ${color}.`,
102+
invalid: `[Alpha]: Invalid opacity "${opacity}" for ${color}.`,
103103
range: 'Must be a number between 0 and 1 (e.g., 0.48).',
104104
format: 'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").',
105105
};
@@ -112,7 +112,7 @@ function validateOpacity(opacity: string | number, color: string): string {
112112

113113
if (typeof opacity === 'number') {
114114
if (opacity >= 0 && opacity <= 1) {
115-
return `${opacity * 100}%`;
115+
return `${Number((opacity * 100).toFixed(2))}%`;
116116
}
117117
throw new Error(`${errors.invalid} ${errors.range}`);
118118
}

0 commit comments

Comments
 (0)