@cwcss/crosswind 0.1.4 → 0.1.5

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cwcss/crosswind",
3
3
  "type": "module",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "description": "A performant Utility-First CSS framework. Similar to Tailwind or UnoCSS.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -27,7 +27,11 @@ function buildShadowColorCache(colors: Record<string, any>): Map<string, string>
27
27
 
28
28
  function applyShadowOpacity(color: string, opacity: number): string {
29
29
  if (color.charCodeAt(0) === 35) { // '#'
30
- const hex = color.slice(1)
30
+ let hex = color.slice(1)
31
+ // Expand 3-char hex (#rgb) to 6-char (#rrggbb)
32
+ if (hex.length === 3) {
33
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]
34
+ }
31
35
  const r = Number.parseInt(hex.slice(0, 2), 16)
32
36
  const g = Number.parseInt(hex.slice(2, 4), 16)
33
37
  const b = Number.parseInt(hex.slice(4, 6), 16)
package/src/rules.ts CHANGED
@@ -419,9 +419,13 @@ function applyOpacity(color: string, opacity: number): string {
419
419
  cleanColor = color.slice(1, -1)
420
420
  }
421
421
 
422
- // If color is hex (#rrggbb), convert to rgb with alpha
422
+ // If color is hex (#rgb or #rrggbb), convert to rgb with alpha
423
423
  if (cleanColor.charCodeAt(0) === 35) { // '#' char code for faster check
424
- const hex = cleanColor.slice(1)
424
+ let hex = cleanColor.slice(1)
425
+ // Expand 3-char hex (#rgb) to 6-char (#rrggbb)
426
+ if (hex.length === 3) {
427
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]
428
+ }
425
429
  const r = Number.parseInt(hex.slice(0, 2), 16)
426
430
  const g = Number.parseInt(hex.slice(2, 4), 16)
427
431
  const b = Number.parseInt(hex.slice(4, 6), 16)