Skip to content

Commit 713bd92

Browse files
committed
Init
0 parents  commit 713bd92

7 files changed

+2569
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
tailwind.dist.css

index.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8" />
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<link rel="stylesheet" href="/tailwind.dist.css" />
6+
<title>Demo</title>
7+
</head>
8+
<body>
9+
<h1 class="text-5xl font-bold text-primary">Hello</h1>
10+
<h1 class="text-5xl font-bold text-primary text-opacity-75">Hello</h1>
11+
<h1 class="text-5xl font-bold text-primary text-opacity-50">Hello</h1>
12+
<h1 class="text-5xl font-bold text-primary text-opacity-25">Hello</h1>
13+
</body>
14+
</html>

package.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "tailwind-variable-text-opacity",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"scripts": {
7+
"dev": "concurrently \"postcss tailwind.css -o tailwind.dist.css -w\" \"live-server .\""
8+
},
9+
"dependencies": {
10+
"autoprefixer": "^9.8.6",
11+
"tailwindcss": "^1.8.9"
12+
},
13+
"devDependencies": {
14+
"concurrently": "^5.3.0",
15+
"live-server": "^1.2.1",
16+
"postcss-cli": "^7.1.2"
17+
}
18+
}

postcss.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}
7+

tailwind.config.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
future: {
3+
removeDeprecatedGapUtilities: true,
4+
purgeLayersByDefault: true,
5+
},
6+
purge: [],
7+
theme: {
8+
colors: {
9+
primary: ({ opacityVariable, opacityValue }) => {
10+
if (opacityValue !== undefined) {
11+
return `rgba(var(--color-primary), ${opacityValue})`
12+
}
13+
if (opacityVariable !== undefined) {
14+
return `rgba(var(--color-primary), var(${opacityVariable}, 1))`
15+
}
16+
return `rgb(var(--color-primary))`
17+
},
18+
secondary: ({ opacityVariable, opacityValue }) => {
19+
if (opacityValue !== undefined) {
20+
return `rgba(var(--color-secondary), ${opacityValue})`
21+
}
22+
if (opacityVariable !== undefined) {
23+
return `rgba(var(--color-secondary), var(${opacityVariable}, 1))`
24+
}
25+
return `rgb(var(--color-secondary))`
26+
},
27+
},
28+
},
29+
variants: {},
30+
plugins: [],
31+
}

tailwind.css

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:root {
2+
--color-primary: 37, 99, 235;
3+
--color-secondary: 253, 224, 71;
4+
}
5+
6+
@tailwind base;
7+
@tailwind components;
8+
@tailwind utilities;

0 commit comments

Comments
 (0)