TailwindCSS ์ธํ (2) - Tailwind Color Custom
๐์์ํ๋ฉฐ
TailwindCSS ์ธํ (1)ํธ์์ plugin์ด๋ ๊ทธ ์ธ ์ธํ ์ ๋ง๋ฌด๋ฆฌ ํ์ผ๋ ์ด๋ฒ์ tailwind ์ปฌ๋ฌ๋ฅผ ์ปค์คํ ํด๋ณด๊ณ ์ ํ๋ค. ์ฌ์ค ๊ฑฐ์ฐฝํด๋ณด์ด์ง๋ง ๋ณ ๊ฑด ์๋ค๐คญ
์ด ๊ธ์ ์๋์ ๊ฐ์ด ์ด์ด์ง๋๋ค.
โ ํ์ํ color ์ถ๊ฐํ๊ธฐ
tailwind ์์ ๊ธฐ๋ณธ์ผ๋ก ์ ๊ณตํ๋ color๋ ์ถฉ๋ถํ ์์์ง๋ง, ๋ด ํ๋ก์ ํธ์๋ ๋ง์ง ์์ ์ ์๋ค. ์ด๋ด ๋ color ๊ฐ์ ์ถ๊ฐํด์ฃผ๋ฉด ๋๋ค. ๋๋ music
์ด๋ ์ด๋ฆ์ผ๋ก ์ปฌ๋ฌ๊ฐ๋ค์ ์ถ๊ฐํด์ฃผ์๋ค. ์ง์ ์ ์ฉํ ๋๋ bg-music-100
์ด๋ฐ์์ผ๋ก ์ ์ฉํ๋ฉด ๋๋ค.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import type { Config } from "tailwindcss"
const config: Config = {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {
colors: {
music: { ๐
100: "#E9F6FC",
//์ฌ๊ธฐ์ ๋ ์ถ๊ฐํด์ฃผ๋ฉด ๋๋ค.
},
},
},
}
export default config
โ ๊ธฐ๋ณธ color ํจ๊ป ์ฌ์ฉํ๊ธฐ
๊ทธ๋ฐ๋ฐ ์์ ๋ด์ฉ๊น์ง๋ง ํ๊ณ ๋๋ด๋ฉด ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ค. ๋๋ gray๋ black๊ณ์ด์ ๊ทธ๋๋ก ์ฌ์ฉํ ์๊ฐ์ด์๋๋ฐ, ์ ๋ ๊ฒ color๋ฅผ ์์ฑํ๋ฉด ๊ธฐ์กด์ color๊ฐ๋ค์ ์ฌ์ฉ์ด ๋ถ๊ฐ๋ฅํด์ง๋ค. ํ์ง๋ง ์น์ ํ tailwind๋ ๊ธฐ์กด color ๊ฐ๋ ์ฌ์ฉํ ์ ์๋๋ก ์ ์ํด์ค๋ค.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import colors from "tailwindcss/colors" ๐
const config: Config = {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
colors: { ๐
//๊ธฐ์กด๊ฐ๋ค์ ๋ถ๋ฌ์์ค๋ค.
transparent: "transparent",
current: "currentColor",
black: colors.black,
white: colors.white,
gray: colors.gray,
emerald: colors.emerald,
indigo: colors.indigo,
yellow: colors.yellow,
music: {
100: "#E9F6FC",
//์ด ๋ถ๋ถ์ ์ปค์คํ
},
},
},
}
export default config
๐ฉ๋ง๋ฌด๋ฆฌ
๋ค์์ ์์ฃผ ์ฌ์ฉํ๋ css ๋ด์ฉ์ ์ ๋ฆฌํด๋ณด๊ณ ์ ํ๋ค!