@biggora/claude-plugins 1.2.0 → 1.2.2
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 +11 -4
- package/package.json +1 -1
- package/registry/registry.json +319 -244
- package/specs/coding.md +24 -0
- package/specs/pod.md +2 -0
- package/src/skills/captcha/README.md +221 -0
- package/src/skills/captcha/SKILL.md +355 -0
- package/src/skills/captcha/references/captcha-types.md +254 -0
- package/src/skills/captcha/references/services.md +172 -0
- package/src/skills/captcha/references/stealth.md +238 -0
- package/src/skills/captcha/scripts/solve_captcha.py +323 -0
- package/src/skills/captcha/scripts/solve_image_grid.py +350 -0
- package/src/skills/google-merchant-api/SKILL.md +581 -0
- package/src/skills/google-merchant-api/references/accounts.md +247 -0
- package/src/skills/google-merchant-api/references/content-api-legacy.md +216 -0
- package/src/skills/google-merchant-api/references/datasources.md +233 -0
- package/src/skills/google-merchant-api/references/inventories.md +201 -0
- package/src/skills/google-merchant-api/references/migration.md +267 -0
- package/src/skills/google-merchant-api/references/products.md +316 -0
- package/src/skills/google-merchant-api/references/promotions.md +201 -0
- package/src/skills/google-merchant-api/references/reports.md +240 -0
- package/src/skills/lv-aggregators-api/SKILL.md +113 -0
- package/src/skills/lv-aggregators-api/references/integration-guide.md +368 -0
- package/src/skills/lv-aggregators-api/references/kurpirkt.md +103 -0
- package/src/skills/lv-aggregators-api/references/salidzini.md +122 -0
- package/src/skills/tailwindcss-best-practices/SKILL.md +180 -0
- package/src/skills/tailwindcss-best-practices/references/best-practices-utility-patterns.md +87 -0
- package/src/skills/tailwindcss-best-practices/references/core-installation.md +109 -0
- package/src/skills/tailwindcss-best-practices/references/core-preflight.md +200 -0
- package/src/skills/tailwindcss-best-practices/references/core-responsive.md +163 -0
- package/src/skills/tailwindcss-best-practices/references/core-source-detection.md +114 -0
- package/src/skills/tailwindcss-best-practices/references/core-theme.md +108 -0
- package/src/skills/tailwindcss-best-practices/references/core-utility-classes.md +59 -0
- package/src/skills/tailwindcss-best-practices/references/core-variants.md +204 -0
- package/src/skills/tailwindcss-best-practices/references/effects-form-controls.md +76 -0
- package/src/skills/tailwindcss-best-practices/references/effects-mask.md +91 -0
- package/src/skills/tailwindcss-best-practices/references/effects-scroll-snap.md +59 -0
- package/src/skills/tailwindcss-best-practices/references/effects-text-shadow.md +78 -0
- package/src/skills/tailwindcss-best-practices/references/effects-transition-animation.md +80 -0
- package/src/skills/tailwindcss-best-practices/references/effects-visibility-interactivity.md +82 -0
- package/src/skills/tailwindcss-best-practices/references/features-content-detection.md +175 -0
- package/src/skills/tailwindcss-best-practices/references/features-custom-styles.md +203 -0
- package/src/skills/tailwindcss-best-practices/references/features-dark-mode.md +137 -0
- package/src/skills/tailwindcss-best-practices/references/features-functions-directives.md +241 -0
- package/src/skills/tailwindcss-best-practices/references/features-upgrade.md +160 -0
- package/src/skills/tailwindcss-best-practices/references/layout-aspect-ratio.md +39 -0
- package/src/skills/tailwindcss-best-practices/references/layout-columns.md +80 -0
- package/src/skills/tailwindcss-best-practices/references/layout-display.md +110 -0
- package/src/skills/tailwindcss-best-practices/references/layout-flexbox.md +112 -0
- package/src/skills/tailwindcss-best-practices/references/layout-grid.md +87 -0
- package/src/skills/tailwindcss-best-practices/references/layout-height.md +97 -0
- package/src/skills/tailwindcss-best-practices/references/layout-inset.md +103 -0
- package/src/skills/tailwindcss-best-practices/references/layout-logical-properties.md +92 -0
- package/src/skills/tailwindcss-best-practices/references/layout-margin.md +126 -0
- package/src/skills/tailwindcss-best-practices/references/layout-min-max-sizing.md +63 -0
- package/src/skills/tailwindcss-best-practices/references/layout-object-fit-position.md +64 -0
- package/src/skills/tailwindcss-best-practices/references/layout-overflow.md +57 -0
- package/src/skills/tailwindcss-best-practices/references/layout-padding.md +77 -0
- package/src/skills/tailwindcss-best-practices/references/layout-position.md +85 -0
- package/src/skills/tailwindcss-best-practices/references/layout-tables.md +67 -0
- package/src/skills/tailwindcss-best-practices/references/layout-width.md +102 -0
- package/src/skills/tailwindcss-best-practices/references/transform-base.md +68 -0
- package/src/skills/tailwindcss-best-practices/references/transform-rotate.md +70 -0
- package/src/skills/tailwindcss-best-practices/references/transform-scale.md +83 -0
- package/src/skills/tailwindcss-best-practices/references/transform-skew.md +62 -0
- package/src/skills/tailwindcss-best-practices/references/transform-translate.md +77 -0
- package/src/skills/tailwindcss-best-practices/references/typography-font-text.md +142 -0
- package/src/skills/tailwindcss-best-practices/references/typography-list-style.md +65 -0
- package/src/skills/tailwindcss-best-practices/references/typography-text-align.md +60 -0
- package/src/skills/tailwindcss-best-practices/references/visual-background.md +76 -0
- package/src/skills/tailwindcss-best-practices/references/visual-border.md +108 -0
- package/src/skills/tailwindcss-best-practices/references/visual-effects.md +111 -0
- package/src/skills/tailwindcss-best-practices/references/visual-svg.md +82 -0
- package/src/skills/test-mobile-app/SKILL.md +11 -6
- package/src/skills/test-mobile-app/scripts/analyze_apk.py +15 -4
- package/src/skills/test-mobile-app/scripts/check_environment.py +5 -5
- package/src/skills/test-mobile-app/scripts/run_tests.py +1 -1
- package/src/skills/test-web-ui/SKILL.md +264 -84
- package/src/skills/test-web-ui/scripts/discover.py +25 -12
- package/src/skills/test-web-ui/scripts/run_tests.py +3 -2
- package/src/skills/vite-best-practices/SKILL.md +115 -0
- package/src/skills/vite-best-practices/references/build-and-ssr.md +255 -0
- package/src/skills/vite-best-practices/references/core-config.md +231 -0
- package/src/skills/vite-best-practices/references/core-features.md +222 -0
- package/src/skills/vite-best-practices/references/core-plugin-api.md +294 -0
- package/src/skills/vite-best-practices/references/environment-api.md +108 -0
- package/src/skills/vite-best-practices/references/rolldown-migration.md +242 -0
- package/codex-cli-workspace/iteration-1/benchmark.json +0 -122
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/eval_metadata.json +0 -13
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/with_skill/grading.json +0 -52
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/with_skill/outputs/response.md +0 -163
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/with_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/without_skill/grading.json +0 -58
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/without_skill/outputs/response.md +0 -151
- package/codex-cli-workspace/iteration-1/eval-1-ci-integration/without_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/eval_metadata.json +0 -13
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/grading.json +0 -52
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/outputs/response.md +0 -86
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/grading.json +0 -58
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/outputs/response.md +0 -164
- package/codex-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/eval_metadata.json +0 -13
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/with_skill/grading.json +0 -52
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/with_skill/outputs/response.md +0 -130
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/with_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/without_skill/grading.json +0 -64
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/without_skill/outputs/response.md +0 -209
- package/codex-cli-workspace/iteration-1/eval-3-profiles-troubleshooting/without_skill/timing.json +0 -5
- package/codex-cli-workspace/iteration-1/review.html +0 -1325
- package/gemini-cli-workspace/iteration-1/benchmark.json +0 -86
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/eval_metadata.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/with_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/with_skill/outputs/response.md +0 -401
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/without_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/without_skill/outputs/response.md +0 -405
- package/gemini-cli-workspace/iteration-1/eval-1-cicd-setup/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/eval_metadata.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/outputs/response.md +0 -212
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/outputs/response.md +0 -427
- package/gemini-cli-workspace/iteration-1/eval-2-mcp-server-config/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/eval_metadata.json +0 -32
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/with_skill/grading.json +0 -32
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/with_skill/outputs/response.md +0 -171
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/without_skill/grading.json +0 -32
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/without_skill/outputs/response.md +0 -199
- package/gemini-cli-workspace/iteration-1/eval-3-custom-slash-command/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-1/review.html +0 -1325
- package/gemini-cli-workspace/iteration-2/benchmark.json +0 -173
- package/gemini-cli-workspace/iteration-2/benchmark.md +0 -28
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/eval_metadata.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/with_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/with_skill/outputs/response.md +0 -195
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/without_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/without_skill/outputs/response.md +0 -377
- package/gemini-cli-workspace/iteration-2/eval-1-cicd-setup/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/eval_metadata.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/with_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/with_skill/outputs/response.md +0 -127
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/without_skill/grading.json +0 -37
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/without_skill/outputs/response.md +0 -164
- package/gemini-cli-workspace/iteration-2/eval-2-mcp-server-config/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/eval_metadata.json +0 -32
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/with_skill/grading.json +0 -32
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/with_skill/outputs/response.md +0 -91
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/with_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/without_skill/grading.json +0 -32
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/without_skill/outputs/response.md +0 -112
- package/gemini-cli-workspace/iteration-2/eval-3-custom-slash-command/without_skill/timing.json +0 -5
- package/gemini-cli-workspace/iteration-2/eval-viewer.html +0 -1325
- package/screen-recording-workspace/evals.json +0 -41
- package/screen-recording-workspace/iteration-1/benchmark.json +0 -102
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/eval_metadata.json +0 -31
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/with_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/with_skill/outputs/demo.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/with_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/without_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/without_skill/outputs/demo.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-0-fullscreen/without_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/eval_metadata.json +0 -31
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/with_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/with_skill/outputs/region_capture.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/with_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/without_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/without_skill/outputs/region_capture.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-1-region-audio/without_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/eval_metadata.json +0 -31
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/with_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/with_skill/outputs/fallback_recording.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/with_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/without_skill/grading.json +0 -11
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/without_skill/outputs/fallback_recording.mp4 +0 -0
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/without_skill/outputs/record_screen.py +0 -67
- package/screen-recording-workspace/iteration-1/eval-2-python-fallback/without_skill/timing.json +0 -5
- package/screen-recording-workspace/iteration-1/review.html +0 -1325
- package/src/skills/codex-cli/evals/evals.json +0 -47
- package/src/skills/gemini-cli/evals/evals.json +0 -46
- package/src/skills/tm-search/evals/evals.json +0 -23
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: features-custom-styles
|
|
3
|
+
description: Adding custom styles, utilities, variants, and working with arbitrary values
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Adding Custom Styles
|
|
7
|
+
|
|
8
|
+
Tailwind is designed to be extensible. This guide covers customizing your theme, using arbitrary values, adding custom CSS, and extending the framework.
|
|
9
|
+
|
|
10
|
+
## Customizing Your Theme
|
|
11
|
+
|
|
12
|
+
Add custom design tokens using `@theme`:
|
|
13
|
+
|
|
14
|
+
```css
|
|
15
|
+
@import "tailwindcss";
|
|
16
|
+
|
|
17
|
+
@theme {
|
|
18
|
+
--font-display: "Satoshi", "sans-serif";
|
|
19
|
+
--breakpoint-3xl: 120rem;
|
|
20
|
+
--color-brand-500: oklch(0.65 0.2 250);
|
|
21
|
+
--ease-fluid: cubic-bezier(0.3, 0, 0, 1);
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Arbitrary Values
|
|
26
|
+
|
|
27
|
+
Use square bracket notation for one-off values that don't belong in your theme:
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<!-- Arbitrary values -->
|
|
31
|
+
<div class="top-[117px] bg-[#bada55] text-[22px]">
|
|
32
|
+
Content
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<!-- With variants -->
|
|
36
|
+
<div class="top-[117px] lg:top-[344px]">
|
|
37
|
+
Content
|
|
38
|
+
</div>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### CSS Variables as Arbitrary Values
|
|
42
|
+
|
|
43
|
+
Reference CSS variables:
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<div class="fill-(--my-brand-color)">
|
|
47
|
+
Content
|
|
48
|
+
</div>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This is shorthand for `fill-[var(--my-brand-color)]`.
|
|
52
|
+
|
|
53
|
+
## Arbitrary Properties
|
|
54
|
+
|
|
55
|
+
Use square brackets for CSS properties Tailwind doesn't have utilities for:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<div class="[mask-type:luminance]">
|
|
59
|
+
Content
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<!-- With variants -->
|
|
63
|
+
<div class="[mask-type:luminance] hover:[mask-type:alpha]">
|
|
64
|
+
Content
|
|
65
|
+
</div>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### CSS Variables
|
|
69
|
+
|
|
70
|
+
Set CSS variables with arbitrary properties:
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<div class="[--scroll-offset:56px] lg:[--scroll-offset:44px]">
|
|
74
|
+
Content
|
|
75
|
+
</div>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Arbitrary Variants
|
|
79
|
+
|
|
80
|
+
Create custom selectors on the fly:
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<ul>
|
|
84
|
+
<li class="lg:[&:nth-child(-n+3)]:hover:underline">Item</li>
|
|
85
|
+
</ul>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Handling Whitespace
|
|
89
|
+
|
|
90
|
+
Use underscores for spaces in arbitrary values:
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<div class="grid-cols-[1fr_500px_2fr]">
|
|
94
|
+
Content
|
|
95
|
+
</div>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Tailwind converts underscores to spaces, except in contexts where underscores are valid (like URLs).
|
|
99
|
+
|
|
100
|
+
## Custom Utilities
|
|
101
|
+
|
|
102
|
+
Add custom utilities with `@utility`:
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
@import "tailwindcss";
|
|
106
|
+
|
|
107
|
+
@utility tab-4 {
|
|
108
|
+
tab-size: 4;
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Now you can use `tab-4` utility class, and it works with variants:
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<div class="tab-4 hover:tab-8">
|
|
116
|
+
Content
|
|
117
|
+
</div>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Custom Variants
|
|
121
|
+
|
|
122
|
+
Add custom variants with `@custom-variant`:
|
|
123
|
+
|
|
124
|
+
```css
|
|
125
|
+
@import "tailwindcss";
|
|
126
|
+
|
|
127
|
+
@custom-variant theme-midnight (&:where([data-theme="midnight"] *));
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Now you can use `theme-midnight:` variant:
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<div class="theme-midnight:bg-black theme-midnight:text-white">
|
|
134
|
+
Content
|
|
135
|
+
</div>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Using Variants in CSS
|
|
139
|
+
|
|
140
|
+
Apply Tailwind variants to custom CSS with `@variant`:
|
|
141
|
+
|
|
142
|
+
```css
|
|
143
|
+
.my-element {
|
|
144
|
+
background: white;
|
|
145
|
+
|
|
146
|
+
@variant dark {
|
|
147
|
+
background: black;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@variant hover {
|
|
151
|
+
background: gray;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Base Styles
|
|
157
|
+
|
|
158
|
+
Add base styles to the `base` layer:
|
|
159
|
+
|
|
160
|
+
```css
|
|
161
|
+
@layer base {
|
|
162
|
+
h1 {
|
|
163
|
+
font-size: var(--text-2xl);
|
|
164
|
+
font-weight: 600;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
h2 {
|
|
168
|
+
font-size: var(--text-xl);
|
|
169
|
+
font-weight: 600;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
a {
|
|
173
|
+
color: var(--color-blue-600);
|
|
174
|
+
text-decoration-line: underline;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Component Styles
|
|
180
|
+
|
|
181
|
+
Add component styles to the `components` layer:
|
|
182
|
+
|
|
183
|
+
```css
|
|
184
|
+
@layer components {
|
|
185
|
+
.btn-primary {
|
|
186
|
+
@apply bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Key Points
|
|
192
|
+
|
|
193
|
+
- Use `@theme` to customize design tokens
|
|
194
|
+
- Arbitrary values with `[]` for one-off values
|
|
195
|
+
- Arbitrary properties for CSS properties without utilities
|
|
196
|
+
- `@utility` for custom utilities
|
|
197
|
+
- `@custom-variant` for custom variants
|
|
198
|
+
- `@layer` for organizing base and component styles
|
|
199
|
+
|
|
200
|
+
<!--
|
|
201
|
+
Source references:
|
|
202
|
+
- https://tailwindcss.com/docs/adding-custom-styles
|
|
203
|
+
-->
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: features-dark-mode
|
|
3
|
+
description: Implementing dark mode with Tailwind's dark variant and custom dark mode strategies
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Dark Mode
|
|
7
|
+
|
|
8
|
+
Tailwind includes a `dark` variant that lets you style your site differently when dark mode is enabled.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Use the `dark:` variant to apply styles in dark mode:
|
|
13
|
+
|
|
14
|
+
```html
|
|
15
|
+
<div class="bg-white dark:bg-gray-800 text-gray-900 dark:text-white">
|
|
16
|
+
Content
|
|
17
|
+
</div>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Default Behavior
|
|
21
|
+
|
|
22
|
+
By default, the `dark` variant uses the `prefers-color-scheme` CSS media feature:
|
|
23
|
+
|
|
24
|
+
```css
|
|
25
|
+
@media (prefers-color-scheme: dark) {
|
|
26
|
+
.dark\:bg-gray-800 {
|
|
27
|
+
background-color: rgb(31 41 55);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Manual Toggle with Class
|
|
33
|
+
|
|
34
|
+
Override the `dark` variant to use a class selector:
|
|
35
|
+
|
|
36
|
+
```css
|
|
37
|
+
@import "tailwindcss";
|
|
38
|
+
|
|
39
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Now dark mode utilities apply when the `dark` class is present:
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<html class="dark">
|
|
46
|
+
<body>
|
|
47
|
+
<div class="bg-white dark:bg-black">Content</div>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Manual Toggle with Data Attribute
|
|
53
|
+
|
|
54
|
+
Use a data attribute instead:
|
|
55
|
+
|
|
56
|
+
```css
|
|
57
|
+
@import "tailwindcss";
|
|
58
|
+
|
|
59
|
+
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<html data-theme="dark">
|
|
64
|
+
<body>
|
|
65
|
+
<div class="bg-white dark:bg-black">Content</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Three-Way Theme Toggle
|
|
71
|
+
|
|
72
|
+
Support light mode, dark mode, and system preference:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
// On page load
|
|
76
|
+
document.documentElement.classList.toggle(
|
|
77
|
+
"dark",
|
|
78
|
+
localStorage.theme === "dark" ||
|
|
79
|
+
(!("theme" in localStorage) &&
|
|
80
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches)
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// Set light mode
|
|
84
|
+
localStorage.theme = "light";
|
|
85
|
+
document.documentElement.classList.remove("dark");
|
|
86
|
+
|
|
87
|
+
// Set dark mode
|
|
88
|
+
localStorage.theme = "dark";
|
|
89
|
+
document.documentElement.classList.add("dark");
|
|
90
|
+
|
|
91
|
+
// Respect system preference
|
|
92
|
+
localStorage.removeItem("theme");
|
|
93
|
+
document.documentElement.classList.toggle(
|
|
94
|
+
"dark",
|
|
95
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
96
|
+
);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Common Patterns
|
|
100
|
+
|
|
101
|
+
### Cards
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg dark:shadow-none">
|
|
105
|
+
<h2 class="text-gray-900 dark:text-white">Title</h2>
|
|
106
|
+
<p class="text-gray-500 dark:text-gray-400">Description</p>
|
|
107
|
+
</div>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Borders
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<div class="border border-gray-200 dark:border-gray-700">
|
|
114
|
+
Content
|
|
115
|
+
</div>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Buttons
|
|
119
|
+
|
|
120
|
+
```html
|
|
121
|
+
<button class="bg-blue-500 hover:bg-blue-600 dark:bg-blue-600 dark:hover:bg-blue-700 text-white">
|
|
122
|
+
Button
|
|
123
|
+
</button>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Key Points
|
|
127
|
+
|
|
128
|
+
- Use `dark:` variant for dark mode styles
|
|
129
|
+
- Default uses `prefers-color-scheme` media query
|
|
130
|
+
- Override with `@custom-variant` for manual toggles
|
|
131
|
+
- Can use class or data attribute selectors
|
|
132
|
+
- Combine with responsive variants: `dark:md:bg-gray-800`
|
|
133
|
+
|
|
134
|
+
<!--
|
|
135
|
+
Source references:
|
|
136
|
+
- https://tailwindcss.com/docs/dark-mode
|
|
137
|
+
-->
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: features-functions-directives
|
|
3
|
+
description: Tailwind's CSS directives (@import, @theme, @utility, @variant) and functions (--alpha, --spacing)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Functions and Directives
|
|
7
|
+
|
|
8
|
+
Tailwind provides custom CSS directives and functions for working with your design system.
|
|
9
|
+
|
|
10
|
+
## Directives
|
|
11
|
+
|
|
12
|
+
Directives are custom Tailwind-specific at-rules that offer special functionality.
|
|
13
|
+
|
|
14
|
+
### @import
|
|
15
|
+
|
|
16
|
+
Import CSS files, including Tailwind:
|
|
17
|
+
|
|
18
|
+
```css
|
|
19
|
+
@import "tailwindcss";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### @theme
|
|
23
|
+
|
|
24
|
+
Define your project's design tokens:
|
|
25
|
+
|
|
26
|
+
```css
|
|
27
|
+
@theme {
|
|
28
|
+
--font-display: "Satoshi", "sans-serif";
|
|
29
|
+
--breakpoint-3xl: 120rem;
|
|
30
|
+
--color-brand-500: oklch(0.65 0.2 250);
|
|
31
|
+
--ease-fluid: cubic-bezier(0.3, 0, 0, 1);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### @source
|
|
36
|
+
|
|
37
|
+
Explicitly specify source files for class detection:
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
@import "tailwindcss";
|
|
41
|
+
@source "../node_modules/@my-company/ui-lib";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### @utility
|
|
45
|
+
|
|
46
|
+
Add custom utilities:
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
@utility tab-4 {
|
|
50
|
+
tab-size: 4;
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Custom utilities work with variants:
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<div class="tab-4 hover:tab-8">Content</div>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### @variant
|
|
61
|
+
|
|
62
|
+
Apply Tailwind variants to styles in your CSS:
|
|
63
|
+
|
|
64
|
+
```css
|
|
65
|
+
.my-element {
|
|
66
|
+
background: white;
|
|
67
|
+
|
|
68
|
+
@variant dark {
|
|
69
|
+
background: black;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### @custom-variant
|
|
75
|
+
|
|
76
|
+
Add custom variants:
|
|
77
|
+
|
|
78
|
+
```css
|
|
79
|
+
@custom-variant theme-midnight (&:where([data-theme="midnight"] *));
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<div class="theme-midnight:bg-black">Content</div>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### @apply
|
|
87
|
+
|
|
88
|
+
Inline existing utility classes into custom CSS:
|
|
89
|
+
|
|
90
|
+
```css
|
|
91
|
+
.select2-dropdown {
|
|
92
|
+
@apply rounded-b-lg shadow-md;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.select2-search {
|
|
96
|
+
@apply rounded border border-gray-300;
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### @reference
|
|
101
|
+
|
|
102
|
+
Import stylesheet for reference without including styles (useful for Vue/Svelte components):
|
|
103
|
+
|
|
104
|
+
```html
|
|
105
|
+
<style>
|
|
106
|
+
@reference "../../app.css";
|
|
107
|
+
|
|
108
|
+
h1 {
|
|
109
|
+
@apply text-2xl font-bold text-red-500;
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Or reference Tailwind directly:
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<style>
|
|
118
|
+
@reference "tailwindcss";
|
|
119
|
+
|
|
120
|
+
h1 {
|
|
121
|
+
@apply text-2xl font-bold;
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Subpath Imports
|
|
127
|
+
|
|
128
|
+
Directives support subpath imports (like TypeScript path aliases):
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"imports": {
|
|
133
|
+
"#app.css": "./src/css/app.css"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```html
|
|
139
|
+
<style>
|
|
140
|
+
@reference "#app.css";
|
|
141
|
+
|
|
142
|
+
h1 {
|
|
143
|
+
@apply text-2xl font-bold;
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Functions
|
|
149
|
+
|
|
150
|
+
Tailwind provides build-time functions for working with colors and spacing.
|
|
151
|
+
|
|
152
|
+
### --alpha()
|
|
153
|
+
|
|
154
|
+
Adjust the opacity of a color:
|
|
155
|
+
|
|
156
|
+
```css
|
|
157
|
+
.my-element {
|
|
158
|
+
color: --alpha(var(--color-lime-300) / 50%);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Compiles to:
|
|
163
|
+
|
|
164
|
+
```css
|
|
165
|
+
.my-element {
|
|
166
|
+
color: color-mix(in oklab, var(--color-lime-300) 50%, transparent);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### --spacing()
|
|
171
|
+
|
|
172
|
+
Generate spacing values based on your theme:
|
|
173
|
+
|
|
174
|
+
```css
|
|
175
|
+
.my-element {
|
|
176
|
+
margin: --spacing(4);
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Compiles to:
|
|
181
|
+
|
|
182
|
+
```css
|
|
183
|
+
.my-element {
|
|
184
|
+
margin: calc(var(--spacing) * 4);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Useful in arbitrary values with `calc()`:
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<div class="py-[calc(--spacing(4)-1px)]">
|
|
192
|
+
Content
|
|
193
|
+
</div>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Compatibility Directives
|
|
197
|
+
|
|
198
|
+
For compatibility with Tailwind CSS v3.x:
|
|
199
|
+
|
|
200
|
+
### @config
|
|
201
|
+
|
|
202
|
+
Load a legacy JavaScript-based configuration:
|
|
203
|
+
|
|
204
|
+
```css
|
|
205
|
+
@config "../../tailwind.config.js";
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### @plugin
|
|
209
|
+
|
|
210
|
+
Load a legacy JavaScript-based plugin:
|
|
211
|
+
|
|
212
|
+
```css
|
|
213
|
+
@plugin "@tailwindcss/typography";
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### theme()
|
|
217
|
+
|
|
218
|
+
Access theme values using dot notation (deprecated):
|
|
219
|
+
|
|
220
|
+
```css
|
|
221
|
+
.my-element {
|
|
222
|
+
margin: theme(spacing.12);
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Note:** Prefer using CSS theme variables instead.
|
|
227
|
+
|
|
228
|
+
## Key Points
|
|
229
|
+
|
|
230
|
+
- Directives are Tailwind-specific at-rules
|
|
231
|
+
- `@theme` defines design tokens
|
|
232
|
+
- `@utility` creates custom utilities
|
|
233
|
+
- `@custom-variant` creates custom variants
|
|
234
|
+
- `@apply` inlines utilities into CSS
|
|
235
|
+
- `--alpha()` and `--spacing()` are build-time functions
|
|
236
|
+
- Compatibility directives support v3.x configs
|
|
237
|
+
|
|
238
|
+
<!--
|
|
239
|
+
Source references:
|
|
240
|
+
- https://tailwindcss.com/docs/functions-and-directives
|
|
241
|
+
-->
|