Skip to content

Commit 77884cc

Browse files
authored
Merge pull request #9 from YAPP-Github/feature/NDGL-30
[NDGL-30] 디자인 시스템 리소스 추가(typography, color, theme)
2 parents 92e38f0 + 11b1fb9 commit 77884cc

5 files changed

Lines changed: 239 additions & 82 deletions

File tree

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,82 @@
11
package com.yapp.ndgl.core.ui.theme
22

3+
import androidx.compose.runtime.Immutable
4+
import androidx.compose.runtime.staticCompositionLocalOf
35
import androidx.compose.ui.graphics.Color
46

5-
val Purple80 = Color(0xFFD0BCFF)
6-
val PurpleGrey80 = Color(0xFFCCC2DC)
7-
val Pink80 = Color(0xFFEFB8C8)
7+
@Immutable
8+
data class NDGLColors(
9+
val white: Color = Color.Unspecified,
810

9-
val Purple40 = Color(0xFF6650a4)
10-
val PurpleGrey40 = Color(0xFF625b71)
11-
val Pink40 = Color(0xFF7D5260)
11+
val primary50: Color = Color.Unspecified,
12+
val primary100: Color = Color.Unspecified,
13+
val primary200: Color = Color.Unspecified,
14+
val primary300: Color = Color.Unspecified,
15+
val primary400: Color = Color.Unspecified,
16+
val primary500: Color = Color.Unspecified,
17+
val primary600: Color = Color.Unspecified,
18+
val primary700: Color = Color.Unspecified,
19+
val primary800: Color = Color.Unspecified,
20+
val primary900: Color = Color.Unspecified,
21+
22+
val secondary50: Color = Color.Unspecified,
23+
val secondary100: Color = Color.Unspecified,
24+
val secondary200: Color = Color.Unspecified,
25+
val secondary300: Color = Color.Unspecified,
26+
val secondary400: Color = Color.Unspecified,
27+
val secondary500: Color = Color.Unspecified,
28+
val secondary600: Color = Color.Unspecified,
29+
val secondary700: Color = Color.Unspecified,
30+
val secondary800: Color = Color.Unspecified,
31+
val secondary900: Color = Color.Unspecified,
32+
33+
val red50: Color = Color.Unspecified,
34+
val red100: Color = Color.Unspecified,
35+
val red200: Color = Color.Unspecified,
36+
val red300: Color = Color.Unspecified,
37+
val red400: Color = Color.Unspecified,
38+
val red500: Color = Color.Unspecified,
39+
val red600: Color = Color.Unspecified,
40+
val red700: Color = Color.Unspecified,
41+
val red800: Color = Color.Unspecified,
42+
val red900: Color = Color.Unspecified,
43+
)
44+
45+
internal val ndglColors = NDGLColors(
46+
white = Color(0xFFFFFFFF),
47+
48+
primary50 = Color(0xFFF0FFF4),
49+
primary100 = Color(0xFFDCFFE4),
50+
primary200 = Color(0xFFBEF5CB),
51+
primary300 = Color(0xFF85E89D),
52+
primary400 = Color(0xFF18B368),
53+
primary500 = Color(0xFF28A745),
54+
primary600 = Color(0xFF22863A),
55+
primary700 = Color(0xFF176F2C),
56+
primary800 = Color(0xFF165C26),
57+
primary900 = Color(0xFF144620),
58+
59+
secondary50 = Color(0xFFF5F5F5),
60+
secondary100 = Color(0xFFE6E6E6),
61+
secondary200 = Color(0xFFD9D9D9),
62+
secondary300 = Color(0xFFB3B3B3),
63+
secondary400 = Color(0xFF757575),
64+
secondary500 = Color(0xFF444444),
65+
secondary600 = Color(0xFF383838),
66+
secondary700 = Color(0xFF2C2C2C),
67+
secondary800 = Color(0xFF1E1E1E),
68+
secondary900 = Color(0xFF111111),
69+
70+
red50 = Color(0xFFFEF2F2),
71+
red100 = Color(0xFFFFE2E2),
72+
red200 = Color(0xFFFFC9C9),
73+
red300 = Color(0xFFFFA2A2),
74+
red400 = Color(0xFFFF6467),
75+
red500 = Color(0xFFFB2C36),
76+
red600 = Color(0xFFE7000B),
77+
red700 = Color(0xFFC10007),
78+
red800 = Color(0xFF9F0712),
79+
red900 = Color(0xFF82181A),
80+
)
81+
82+
val LocalNDGLColors = staticCompositionLocalOf { NDGLColors() }
Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,56 @@
11
package com.yapp.ndgl.core.ui.theme
22

3-
import android.os.Build
4-
import androidx.compose.foundation.isSystemInDarkTheme
53
import androidx.compose.material3.MaterialTheme
6-
import androidx.compose.material3.darkColorScheme
7-
import androidx.compose.material3.dynamicDarkColorScheme
8-
import androidx.compose.material3.dynamicLightColorScheme
4+
import androidx.compose.material3.Typography
95
import androidx.compose.material3.lightColorScheme
106
import androidx.compose.runtime.Composable
11-
import androidx.compose.ui.platform.LocalContext
7+
import androidx.compose.runtime.CompositionLocalProvider
8+
import androidx.compose.runtime.ReadOnlyComposable
129

13-
private val DarkColorScheme = darkColorScheme(
14-
primary = Purple80,
15-
secondary = PurpleGrey80,
16-
tertiary = Pink80,
17-
)
10+
object NDGLTheme {
11+
val colors: NDGLColors
12+
@Composable
13+
@ReadOnlyComposable
14+
get() = LocalNDGLColors.current
1815

19-
private val LightColorScheme = lightColorScheme(
20-
primary = Purple40,
21-
secondary = PurpleGrey40,
22-
tertiary = Pink40,
23-
24-
/* Other default colors to override
25-
background = Color(0xFFFFFBFE),
26-
surface = Color(0xFFFFFBFE),
27-
onPrimary = Color.White,
28-
onSecondary = Color.White,
29-
onTertiary = Color.White,
30-
onBackground = Color(0xFF1C1B1F),
31-
onSurface = Color(0xFF1C1B1F),
32-
*/
33-
)
16+
val typography: NDGLTypography
17+
@Composable
18+
@ReadOnlyComposable
19+
get() = LocalNDGLTypography.current
20+
}
3421

3522
@Composable
3623
fun NDGLTheme(
37-
darkTheme: Boolean = isSystemInDarkTheme(),
38-
// Dynamic color is available on Android 12+
39-
dynamicColor: Boolean = true,
4024
content: @Composable () -> Unit,
4125
) {
42-
val colorScheme = when {
43-
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
44-
val context = LocalContext.current
45-
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
46-
}
26+
CompositionLocalProvider(
27+
LocalNDGLColors provides ndglColors,
28+
LocalNDGLTypography provides ndglTypography,
29+
) {
30+
val colorScheme = lightColorScheme(
31+
primary = NDGLTheme.colors.primary500,
32+
secondary = NDGLTheme.colors.secondary500,
33+
background = NDGLTheme.colors.white,
34+
surface = NDGLTheme.colors.white,
35+
)
4736

48-
darkTheme -> DarkColorScheme
49-
else -> LightColorScheme
50-
}
37+
val typography = Typography(
38+
headlineLarge = NDGLTheme.typography.titleLgBold,
39+
headlineMedium = NDGLTheme.typography.titleMdBold,
40+
titleLarge = NDGLTheme.typography.subtitleLgSemiBold,
41+
titleMedium = NDGLTheme.typography.subtitleMdSemiBold,
42+
bodyLarge = NDGLTheme.typography.bodyLgMedium,
43+
bodyMedium = NDGLTheme.typography.bodyMdMedium,
44+
bodySmall = NDGLTheme.typography.bodyMdRegular,
45+
labelLarge = NDGLTheme.typography.bodySmSemiBold,
46+
labelMedium = NDGLTheme.typography.bodySmMedium,
47+
labelSmall = NDGLTheme.typography.bodySmRegular,
48+
)
5149

52-
MaterialTheme(
53-
colorScheme = colorScheme,
54-
typography = Typography,
55-
content = content,
56-
)
50+
MaterialTheme(
51+
colorScheme = colorScheme,
52+
typography = typography,
53+
content = content,
54+
)
55+
}
5756
}

core/ui/src/main/java/com/yapp/ndgl/core/ui/theme/Type.kt

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
package com.yapp.ndgl.core.ui.theme
2+
3+
import androidx.compose.runtime.Immutable
4+
import androidx.compose.runtime.staticCompositionLocalOf
5+
import androidx.compose.ui.text.TextStyle
6+
import androidx.compose.ui.text.font.Font
7+
import androidx.compose.ui.text.font.FontFamily
8+
import androidx.compose.ui.text.font.FontWeight
9+
import androidx.compose.ui.unit.sp
10+
import com.yapp.ndgl.core.ui.R
11+
12+
private val Pretendard = FontFamily(
13+
Font(R.font.pretendard, FontWeight.Normal),
14+
Font(R.font.pretendard, FontWeight.Medium),
15+
Font(R.font.pretendard, FontWeight.SemiBold),
16+
Font(R.font.pretendard, FontWeight.Bold),
17+
)
18+
19+
@Immutable
20+
data class NDGLTypography(
21+
val titleLgBold: TextStyle = TextStyle(
22+
fontFamily = Pretendard,
23+
fontWeight = FontWeight.Bold,
24+
fontSize = 32.sp,
25+
),
26+
val titleLgSemiBold: TextStyle = TextStyle(
27+
fontFamily = Pretendard,
28+
fontWeight = FontWeight.SemiBold,
29+
fontSize = 32.sp,
30+
),
31+
32+
val titleMdBold: TextStyle = TextStyle(
33+
fontFamily = Pretendard,
34+
fontWeight = FontWeight.Bold,
35+
fontSize = 22.sp,
36+
),
37+
val titleMdSemiBold: TextStyle = TextStyle(
38+
fontFamily = Pretendard,
39+
fontWeight = FontWeight.SemiBold,
40+
fontSize = 22.sp,
41+
),
42+
43+
val subtitleLgSemiBold: TextStyle = TextStyle(
44+
fontFamily = Pretendard,
45+
fontWeight = FontWeight.SemiBold,
46+
fontSize = 20.sp,
47+
),
48+
val subtitleLgMedium: TextStyle = TextStyle(
49+
fontFamily = Pretendard,
50+
fontWeight = FontWeight.Medium,
51+
fontSize = 20.sp,
52+
),
53+
54+
val subtitleMdBold: TextStyle = TextStyle(
55+
fontFamily = Pretendard,
56+
fontWeight = FontWeight.Bold,
57+
fontSize = 18.sp,
58+
),
59+
val subtitleMdSemiBold: TextStyle = TextStyle(
60+
fontFamily = Pretendard,
61+
fontWeight = FontWeight.SemiBold,
62+
fontSize = 18.sp,
63+
),
64+
val subtitleMdMedium: TextStyle = TextStyle(
65+
fontFamily = Pretendard,
66+
fontWeight = FontWeight.Medium,
67+
fontSize = 18.sp,
68+
),
69+
70+
val bodyLgSemiBold: TextStyle = TextStyle(
71+
fontFamily = Pretendard,
72+
fontWeight = FontWeight.SemiBold,
73+
fontSize = 16.sp,
74+
),
75+
val bodyLgMedium: TextStyle = TextStyle(
76+
fontFamily = Pretendard,
77+
fontWeight = FontWeight.Medium,
78+
fontSize = 16.sp,
79+
),
80+
val bodyLgRegular: TextStyle = TextStyle(
81+
fontFamily = Pretendard,
82+
fontWeight = FontWeight.Normal,
83+
fontSize = 16.sp,
84+
),
85+
86+
val bodyMdSemiBold: TextStyle = TextStyle(
87+
fontFamily = Pretendard,
88+
fontWeight = FontWeight.SemiBold,
89+
fontSize = 14.sp,
90+
),
91+
val bodyMdMedium: TextStyle = TextStyle(
92+
fontFamily = Pretendard,
93+
fontWeight = FontWeight.Medium,
94+
fontSize = 14.sp,
95+
),
96+
val bodyMdRegular: TextStyle = TextStyle(
97+
fontFamily = Pretendard,
98+
fontWeight = FontWeight.Normal,
99+
fontSize = 14.sp,
100+
),
101+
102+
val bodySmSemiBold: TextStyle = TextStyle(
103+
fontFamily = Pretendard,
104+
fontWeight = FontWeight.SemiBold,
105+
fontSize = 12.sp,
106+
),
107+
val bodySmMedium: TextStyle = TextStyle(
108+
fontFamily = Pretendard,
109+
fontWeight = FontWeight.Medium,
110+
fontSize = 12.sp,
111+
),
112+
val bodySmRegular: TextStyle = TextStyle(
113+
fontFamily = Pretendard,
114+
fontWeight = FontWeight.Normal,
115+
fontSize = 12.sp,
116+
),
117+
)
118+
119+
internal val ndglTypography = NDGLTypography()
120+
121+
val LocalNDGLTypography = staticCompositionLocalOf { NDGLTypography() }
6.43 MB
Binary file not shown.

0 commit comments

Comments
 (0)