css-utility-functions 1.1.0 → 1.2.0
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/README.md +18 -0
- package/dist/index.css +53 -1
- package/dist/index.min.css +7 -2
- package/package.json +1 -1
- package/src/effects/polka-dots.css +51 -0
- package/src/index.css +1 -0
package/README.md
CHANGED
|
@@ -178,6 +178,23 @@ Inset elevation shadows for embossed/debossed effects. Optionally control light
|
|
|
178
178
|
}
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
+
#### `--polka-dots()`
|
|
182
|
+
Repeating polka dot pattern background using two offset radial-gradient layers.
|
|
183
|
+
|
|
184
|
+
```css
|
|
185
|
+
.polka-bg {
|
|
186
|
+
background: --polka-dots();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.custom-dots {
|
|
190
|
+
background: --polka-dots(
|
|
191
|
+
--dot-color: #3b82f6,
|
|
192
|
+
--spacing: 10px,
|
|
193
|
+
--dot-size: 30%
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
181
198
|
---
|
|
182
199
|
|
|
183
200
|
### Layout Utilities
|
|
@@ -231,6 +248,7 @@ Convert between pixels and rem (assumes 16px base).
|
|
|
231
248
|
| `--shadow()` | Elevation shadows | `--shadow(3)` |
|
|
232
249
|
| `--bevel()` | Inset shadows (emboss/deboss) | `--bevel(2)` |
|
|
233
250
|
| `--diagonal-lines()` | Diagonal line pattern | `--diagonal-lines(--angle: 45deg)` |
|
|
251
|
+
| `--polka-dots()` | Polka dot pattern | `--polka-dots(--dot-color: black, --spacing: 8px)` |
|
|
234
252
|
| **Layout Utilities** |||
|
|
235
253
|
| `--neg()` | Negate value | `--neg(2rem)` → `-2rem` |
|
|
236
254
|
| **Math Utilities** |||
|
package/dist/index.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CSS Utility Functions v1.
|
|
2
|
+
* CSS Utility Functions v1.2.0
|
|
3
3
|
* Author: Yair Even-Or
|
|
4
4
|
* Repository: https://github.com/yairEO/css-utility-functions
|
|
5
5
|
*
|
|
@@ -507,6 +507,58 @@
|
|
|
507
507
|
);
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
+
/**
|
|
511
|
+
* --polka-dots() — Polka Dot Pattern Background
|
|
512
|
+
*
|
|
513
|
+
* Generate a repeating polka dot pattern using two offset radial-gradient layers.
|
|
514
|
+
* Returns a complete background value (image + position + size) that can be used
|
|
515
|
+
* directly as a background property value.
|
|
516
|
+
*
|
|
517
|
+
* @param {color} --dot-color - Color of the dots, default: currentColor
|
|
518
|
+
* @param {length-percentage} --dot-size - Size of each dot; accepts px or %. A 1px feather zone
|
|
519
|
+
* is applied at the edge for anti-aliasing. Default: 20%
|
|
520
|
+
* @param {length} --spacing - Half the tile size; controls dot density, default: 5px
|
|
521
|
+
* @param {color} --bg-color - Background color between dots, default: transparent
|
|
522
|
+
* @returns {image} - Complete two-layer radial-gradient background value
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
525
|
+
* .polka-bg {
|
|
526
|
+
* background: --polka-dots();
|
|
527
|
+
* }
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
* .custom-dots {
|
|
531
|
+
* background: --polka-dots(
|
|
532
|
+
* --dot-color: #3b82f6,
|
|
533
|
+
* --spacing: 10px,
|
|
534
|
+
* --dot-size: 30%
|
|
535
|
+
* );
|
|
536
|
+
* }
|
|
537
|
+
*
|
|
538
|
+
* @example
|
|
539
|
+
* .subtle-dots {
|
|
540
|
+
* color: #94a3b8;
|
|
541
|
+
* background: --polka-dots(
|
|
542
|
+
* --dot-color: currentColor,
|
|
543
|
+
* --spacing: 8px,
|
|
544
|
+
* --dot-size: 15%
|
|
545
|
+
* );
|
|
546
|
+
* }
|
|
547
|
+
*/
|
|
548
|
+
|
|
549
|
+
@function --polka-dots(
|
|
550
|
+
--dot-color <color>: currentColor,
|
|
551
|
+
--dot-size <length-percentage>: 20%,
|
|
552
|
+
--spacing <length>: 5px,
|
|
553
|
+
--bg-color <color>: transparent
|
|
554
|
+
) returns <image> {
|
|
555
|
+
result:
|
|
556
|
+
radial-gradient(var(--dot-color) calc(var(--dot-size) - 1px), var(--bg-color) var(--dot-size))
|
|
557
|
+
0 0 / calc(var(--spacing) * 2) calc(var(--spacing) * 2),
|
|
558
|
+
radial-gradient(var(--dot-color) calc(var(--dot-size) - 1px), var(--bg-color) var(--dot-size))
|
|
559
|
+
var(--spacing) var(--spacing) / calc(var(--spacing) * 2) calc(var(--spacing) * 2);
|
|
560
|
+
}
|
|
561
|
+
|
|
510
562
|
/* Layout Utilities */
|
|
511
563
|
|
|
512
564
|
/**
|
package/dist/index.min.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CSS Utility Functions v1.
|
|
2
|
+
* CSS Utility Functions v1.2.0
|
|
3
3
|
* Author: Yair Even-Or
|
|
4
4
|
* Repository: https://github.com/yairEO/css-utility-functions
|
|
5
5
|
*
|
|
@@ -49,7 +49,12 @@
|
|
|
49
49
|
--line-width <length>: 1px,
|
|
50
50
|
--gap-width <length>: 4px,
|
|
51
51
|
--gap-color <color>: transparent
|
|
52
|
-
) returns <image>{result:repeating-linear-gradient(var(--angle),var(--line-color) 0,var(--line-color) calc(var(--line-width) - 1px),var(--gap-color) calc(var(--line-width) + 1px),var(--gap-color) calc(var(--line-width) + var(--gap-width)))}@function --
|
|
52
|
+
) returns <image>{result:repeating-linear-gradient(var(--angle),var(--line-color) 0,var(--line-color) calc(var(--line-width) - 1px),var(--gap-color) calc(var(--line-width) + 1px),var(--gap-color) calc(var(--line-width) + var(--gap-width)))}@function --polka-dots(
|
|
53
|
+
--dot-color <color>: currentColor,
|
|
54
|
+
--dot-size <length-percentage>: 20%,
|
|
55
|
+
--spacing <length>: 5px,
|
|
56
|
+
--bg-color <color>: transparent
|
|
57
|
+
) returns <image>{result:radial-gradient(var(--dot-color) calc(var(--dot-size) - 1px),var(--bg-color) var(--dot-size)) 0 0 /calc(var(--spacing) * 2) calc(var(--spacing) * 2),radial-gradient(var(--dot-color) calc(var(--dot-size) - 1px),var(--bg-color) var(--dot-size)) var(--spacing) var(--spacing) /calc(var(--spacing) * 2) calc(var(--spacing) * 2)}@function --neg(--value <length>) returns <length>{result:calc(var(--value) * -1)}@function --lerp(
|
|
53
58
|
--a <length-percentage>,
|
|
54
59
|
--b <length-percentage>,
|
|
55
60
|
--t <number>: 0.5
|
package/package.json
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* --polka-dots() — Polka Dot Pattern Background
|
|
3
|
+
*
|
|
4
|
+
* Generate a repeating polka dot pattern using two offset radial-gradient layers.
|
|
5
|
+
* Returns a complete background value (image + position + size) that can be used
|
|
6
|
+
* directly as a background property value.
|
|
7
|
+
*
|
|
8
|
+
* @param {color} --dot-color - Color of the dots, default: currentColor
|
|
9
|
+
* @param {length-percentage} --dot-size - Size of each dot; accepts px or %. A 1px feather zone
|
|
10
|
+
* is applied at the edge for anti-aliasing. Default: 20%
|
|
11
|
+
* @param {length} --spacing - Half the tile size; controls dot density, default: 5px
|
|
12
|
+
* @param {color} --bg-color - Background color between dots, default: transparent
|
|
13
|
+
* @returns {image} - Complete two-layer radial-gradient background value
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* .polka-bg {
|
|
17
|
+
* background: --polka-dots();
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* .custom-dots {
|
|
22
|
+
* background: --polka-dots(
|
|
23
|
+
* --dot-color: #3b82f6,
|
|
24
|
+
* --spacing: 10px,
|
|
25
|
+
* --dot-size: 30%
|
|
26
|
+
* );
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* .subtle-dots {
|
|
31
|
+
* color: #94a3b8;
|
|
32
|
+
* background: --polka-dots(
|
|
33
|
+
* --dot-color: currentColor,
|
|
34
|
+
* --spacing: 8px,
|
|
35
|
+
* --dot-size: 15%
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
@function --polka-dots(
|
|
41
|
+
--dot-color <color>: currentColor,
|
|
42
|
+
--dot-size <length-percentage>: 20%,
|
|
43
|
+
--spacing <length>: 5px,
|
|
44
|
+
--bg-color <color>: transparent
|
|
45
|
+
) returns <image> {
|
|
46
|
+
result:
|
|
47
|
+
radial-gradient(var(--dot-color) calc(var(--dot-size) - 1px), var(--bg-color) var(--dot-size))
|
|
48
|
+
0 0 / calc(var(--spacing) * 2) calc(var(--spacing) * 2),
|
|
49
|
+
radial-gradient(var(--dot-color) calc(var(--dot-size) - 1px), var(--bg-color) var(--dot-size))
|
|
50
|
+
var(--spacing) var(--spacing) / calc(var(--spacing) * 2) calc(var(--spacing) * 2);
|
|
51
|
+
}
|