sparkle-design-cli 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -197,14 +197,14 @@ function hexToOklch(hex) {
197
197
  // #を削除
198
198
  const cleanHex = hex.replace('#', '');
199
199
 
200
- // 3桁の場合は6桁に拡張
201
- const fullHex =
202
- cleanHex.length === 3
203
- ? cleanHex
204
- .split('')
205
- .map((char) => char + char)
206
- .join('')
207
- : cleanHex;
200
+ // 3桁の場合は6桁に、4桁の場合は8桁に拡張
201
+ let fullHex = cleanHex;
202
+ if (cleanHex.length === 3 || cleanHex.length === 4) {
203
+ fullHex = cleanHex
204
+ .split('')
205
+ .map((char) => char + char)
206
+ .join('');
207
+ }
208
208
 
209
209
  // culoriを使用してHEXからOKLCHに変換
210
210
  const oklchColor = oklch(`#${fullHex}`);
@@ -219,6 +219,12 @@ function hexToOklch(hex) {
219
219
  const c = Math.round((oklchColor.c || 0) * 10000) / 10000;
220
220
  const h = oklchColor.h ? Math.round(oklchColor.h * 10) / 10 : 0;
221
221
 
222
+ // アルファ値がある場合(1未満の場合のみ出力に追加)
223
+ if (oklchColor.alpha !== undefined && oklchColor.alpha < 1) {
224
+ const a = Math.round(oklchColor.alpha * 10000) / 10000;
225
+ return `oklch(${l} ${c} ${h} / ${a})`;
226
+ }
227
+
222
228
  return `oklch(${l} ${c} ${h})`;
223
229
  }
224
230
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sparkle-design-cli",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Sparkle Design CSS Generator - デザインシステムCSSを設定ファイルから生成するツール",
5
5
  "main": "lib/generate-css.js",
6
6
  "type": "module",
@@ -85,6 +85,30 @@
85
85
  },
86
86
  "black": "#000000",
87
87
  "white": "#ffffff",
88
+ "black-alpha": {
89
+ "50": "#0000000D",
90
+ "100": "#0000001A",
91
+ "200": "#00000033",
92
+ "300": "#0000004D",
93
+ "400": "#00000066",
94
+ "500": "#00000080",
95
+ "600": "#00000099",
96
+ "700": "#000000B3",
97
+ "800": "#000000CC",
98
+ "900": "#000000E6"
99
+ },
100
+ "white-alpha": {
101
+ "50": "#FFFFFF0D",
102
+ "100": "#FFFFFF1A",
103
+ "200": "#FFFFFF33",
104
+ "300": "#FFFFFF4D",
105
+ "400": "#FFFFFF66",
106
+ "500": "#FFFFFF80",
107
+ "600": "#FFFFFF99",
108
+ "700": "#FFFFFFB3",
109
+ "800": "#FFFFFFCC",
110
+ "900": "#FFFFFFE6"
111
+ },
88
112
  "ring": {
89
113
  "normal": "#096cdc"
90
114
  }