diff --git a/core/src/main/java/com/terning/core/designsystem/theme/Color.kt b/core/src/main/java/com/terning/core/designsystem/theme/Color.kt new file mode 100644 index 000000000..d3a07d610 --- /dev/null +++ b/core/src/main/java/com/terning/core/designsystem/theme/Color.kt @@ -0,0 +1,39 @@ +package com.terning.core.designsystem.theme + +import androidx.compose.ui.graphics.Color + +// Grey Scale +val White = Color(0xFFFFFFFF) +val Grey100 = Color(0xFFF5F5F5) +val Grey150 = Color(0xFFE9E9E9) +val Grey200 = Color(0xFFDDDDDD) +val Grey300 = Color(0xFFBCBCBC) +val Grey350 = Color(0xFFADADAD) +val Grey400 = Color(0xFF666666) +val Grey500 = Color(0xFF373737) +val Black = Color(0xFF171717) + +// Main Color +val TerningMain = Color(0xFF1EA65E) + +// Calendar Color +val CalRed = Color(0xFFED4E54) + +val CalOrange1 = Color(0xFFEE7647) +val CalOrange2 = Color(0xFF5397F3) + +val CalYellow = Color(0xFFF5E660) + +val CalGreen1 = Color(0xFFC4E953) +val CalGreen2 = Color(0xFF84D558) + +val CalBlue1 = Color(0xFF45D0CC) +val CalBlue2 = Color(0xFF4119F2) + +val CalPurple = Color(0xFF9B64E2) + +val CalPink = Color(0xFFF260AC) + +// Other +val WarningRed = Color(0xFFF54645) +val SundayRed = Color(0xFFEB1211) \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/theme/Theme.kt b/core/src/main/java/com/terning/core/designsystem/theme/Theme.kt new file mode 100644 index 000000000..f0e0970ec --- /dev/null +++ b/core/src/main/java/com/terning/core/designsystem/theme/Theme.kt @@ -0,0 +1,51 @@ +package com.terning.core.designsystem.theme + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.remember +import androidx.compose.runtime.staticCompositionLocalOf + +private val LightColorScheme = lightColorScheme( + primary = TerningMain, +) + +private val LocalTerningTypography = staticCompositionLocalOf { + error("No TerningTypography provided") +} + +object TerningTheme { + val typography: TerningTypography + @Composable + get() = LocalTerningTypography.current +} + +@Composable +fun ProvideTerningTypography(typography: TerningTypography, content: @Composable () -> Unit) { + val provideTypography = remember { typography.copy() } + provideTypography.update(typography) + CompositionLocalProvider( + LocalTerningTypography provides provideTypography, + content = content + ) +} + +@Composable +fun TerningTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = LightColorScheme + val typography = TerningTypography() + + ProvideTerningTypography(typography = typography) { + MaterialTheme( + colorScheme = colorScheme, + content = content, + ) + } +} \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/designsystem/theme/Type.kt b/core/src/main/java/com/terning/core/designsystem/theme/Type.kt new file mode 100644 index 000000000..03c10cb34 --- /dev/null +++ b/core/src/main/java/com/terning/core/designsystem/theme/Type.kt @@ -0,0 +1,415 @@ +package com.terning.core.designsystem.theme + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.Stable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.Font +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.em +import androidx.compose.ui.unit.sp +import com.terning.core.R + +val PretendardSemiBold = FontFamily(Font(R.font.pretendard_semibold)) +val PretendardMedium = FontFamily(Font(R.font.pretendard_medium)) +val PretendardRegular = FontFamily(Font(R.font.pretendard_regular)) +val PretendardLight = FontFamily(Font(R.font.pretendard_light)) + +@Stable +class TerningTypography internal constructor( + heading1: TextStyle, + heading2: TextStyle, + title1: TextStyle, + title2: TextStyle, + title3: TextStyle, + title4: TextStyle, + title5: TextStyle, + body0: TextStyle, + body1: TextStyle, + body2: TextStyle, + body3: TextStyle, + body4: TextStyle, + body5: TextStyle, + body6: TextStyle, + body7: TextStyle, + button0: TextStyle, + button1: TextStyle, + button2: TextStyle, + button3: TextStyle, + button4: TextStyle, + button5: TextStyle, + button6: TextStyle, + detail0: TextStyle, + detail1: TextStyle, + detail2: TextStyle, + detail3: TextStyle, + detail4: TextStyle, + detail5: TextStyle, + calendar: TextStyle, +) { + var heading1: TextStyle by mutableStateOf(heading1) + private set + var heading2: TextStyle by mutableStateOf(heading2) + private set + var title1: TextStyle by mutableStateOf(title1) + private set + var title2: TextStyle by mutableStateOf(title2) + private set + var title3: TextStyle by mutableStateOf(title3) + private set + var title4: TextStyle by mutableStateOf(title4) + private set + var title5: TextStyle by mutableStateOf(title5) + private set + var body0: TextStyle by mutableStateOf(body0) + private set + var body1: TextStyle by mutableStateOf(body1) + private set + var body2: TextStyle by mutableStateOf(body2) + private set + var body3: TextStyle by mutableStateOf(body3) + private set + var body4: TextStyle by mutableStateOf(body4) + private set + var body5: TextStyle by mutableStateOf(body5) + private set + var body6: TextStyle by mutableStateOf(body6) + private set + var body7: TextStyle by mutableStateOf(body7) + private set + var button0: TextStyle by mutableStateOf(button0) + private set + var button1: TextStyle by mutableStateOf(button1) + private set + var button2: TextStyle by mutableStateOf(button2) + private set + var button3: TextStyle by mutableStateOf(button3) + private set + var button4: TextStyle by mutableStateOf(button4) + private set + var button5: TextStyle by mutableStateOf(button5) + private set + var button6: TextStyle by mutableStateOf(button6) + private set + var detail0: TextStyle by mutableStateOf(detail0) + private set + var detail1: TextStyle by mutableStateOf(detail1) + private set + var detail2: TextStyle by mutableStateOf(detail2) + private set + var detail3: TextStyle by mutableStateOf(detail3) + private set + var detail4: TextStyle by mutableStateOf(detail4) + private set + var detail5: TextStyle by mutableStateOf(detail5) + private set + var calendar: TextStyle by mutableStateOf(calendar) + private set + + fun copy( + heading1: TextStyle = this.heading1, + heading2: TextStyle = this.heading2, + title1: TextStyle = this.title1, + title2: TextStyle = this.title2, + title3: TextStyle = this.title3, + title4: TextStyle = this.title4, + title5: TextStyle = this.title5, + body0: TextStyle = this.body0, + body1: TextStyle = this.body1, + body2: TextStyle = this.body2, + body3: TextStyle = this.body3, + body4: TextStyle = this.body4, + body5: TextStyle = this.body5, + body6: TextStyle = this.body6, + body7: TextStyle = this.body7, + button0: TextStyle = this.button0, + button1: TextStyle = this.button1, + button2: TextStyle = this.button2, + button3: TextStyle = this.button3, + button4: TextStyle = this.button4, + button5: TextStyle = this.button5, + button6: TextStyle = this.button6, + detail0: TextStyle = this.detail0, + detail1: TextStyle = this.detail1, + detail2: TextStyle = this.detail2, + detail3: TextStyle = this.detail3, + detail4: TextStyle = this.detail4, + detail5: TextStyle = this.detail5, + calendar: TextStyle = this.calendar, + ): TerningTypography = TerningTypography( + heading1, + heading2, + title1, + title2, + title3, + title4, + title5, + body0, + body1, + body2, + body3, + body4, + body5, + body6, + body7, + button0, + button1, + button2, + button3, + button4, + button5, + button6, + detail0, + detail1, + detail2, + detail3, + detail4, + detail5, + calendar, + ) + + fun update(other: TerningTypography) { + heading1 = other.heading1 + heading2 = other.heading2 + title1 = other.title1 + title2 = other.title2 + title3 = other.title3 + title4 = other.title4 + title5 = other.title5 + body0 = other.body0 + body1 = other.body1 + body2 = other.body2 + body3 = other.body3 + body4 = other.body4 + body5 = other.body5 + body6 = other.body6 + body7 = other.body7 + button0 = other.button0 + button1 = other.button1 + button2 = other.button2 + button3 = other.button3 + button4 = other.button4 + button5 = other.button5 + button6 = other.button6 + detail0 = other.detail0 + detail1 = other.detail1 + detail2 = other.detail2 + detail3 = other.detail3 + detail4 = other.detail4 + detail5 = other.detail5 + calendar = other.calendar + } +} + + +@Composable +fun TerningTypography(): TerningTypography { + return TerningTypography( + heading1 = TextStyle( + fontFamily = PretendardSemiBold, + fontWeight = FontWeight.SemiBold, + fontSize = 23.sp, + letterSpacing = (-0.005).em, + lineHeight = 23.sp, + ), + heading2 = TextStyle( + fontFamily = PretendardSemiBold, + fontWeight = FontWeight.SemiBold, + fontSize = 21.sp, + letterSpacing = (-0.005).em, + lineHeight = (27.3).sp, + ), + title1 = TextStyle( + fontFamily = PretendardSemiBold, + fontWeight = FontWeight.SemiBold, + fontSize = 19.sp, + letterSpacing = (-0.005).em, + lineHeight = (22.8).sp, + ), + title2 = TextStyle( + fontFamily = PretendardSemiBold, + fontWeight = FontWeight.SemiBold, + fontSize = 17.sp, + letterSpacing = (-0.005).em, + lineHeight = (22.1).sp, + ), + title3 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 17.sp, + letterSpacing = (-0.005).em, + lineHeight = (22.1).sp, + ), + title4 = TextStyle( + fontFamily = PretendardSemiBold, + fontWeight = FontWeight.SemiBold, + fontSize = 15.sp, + letterSpacing = (-0.005).em, + lineHeight = (19.5).sp, + ), + title5 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 14.sp, + letterSpacing = (0.002).em, + lineHeight = (16.8).sp, + ), + body0 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 19.sp, + letterSpacing = (0.002).em, + lineHeight = 19.sp, + ), + body1 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 15.sp, + letterSpacing = (0.002).em, + lineHeight = 15.sp, + ), + body2 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 14.sp, + letterSpacing = (0.002).em, + lineHeight = (16.8).sp, + ), + body3 = TextStyle( + fontFamily = PretendardRegular, + fontWeight = FontWeight.Normal, + fontSize = 13.sp, + letterSpacing = (0.002).em, + lineHeight = (15.6).sp, + ), + body4 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 13.sp, + letterSpacing = (0.002).em, + lineHeight = (19.5).sp, + ), + body5 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 13.sp, + letterSpacing = (0.002).em, + lineHeight = (15.6).sp, + ), + body6 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + letterSpacing = (0.002).em, + lineHeight = (13.2).sp, + ), + body7 = TextStyle( + fontFamily = PretendardLight, + fontWeight = FontWeight.Light, + fontSize = 11.sp, + letterSpacing = (0.002).em, + lineHeight = 11.sp, + ), + button0 = TextStyle( + fontFamily = PretendardSemiBold, + fontWeight = FontWeight.SemiBold, + fontSize = 15.sp, + letterSpacing = (0.002).em, + lineHeight = 15.sp, + ), + button1 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 15.sp, + letterSpacing = (0.002).em, + lineHeight = 15.sp, + ), + button2 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 15.sp, + letterSpacing = (0.002).em, + lineHeight = 18.sp, + ), + button3 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 13.sp, + letterSpacing = (0.002).em, + lineHeight = (15.6).sp, + ), + button4 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + letterSpacing = (0).em, + lineHeight = 11.sp, + ), + button5 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 10.sp, + letterSpacing = (0.002).em, + lineHeight = 15.sp, + ), + button6 = TextStyle( + fontFamily = PretendardMedium, + fontWeight = FontWeight.Medium, + fontSize = 9.sp, + letterSpacing = (0.002).em, + lineHeight = 9.sp, + ), + detail0 = TextStyle( + fontFamily = PretendardSemiBold, + fontWeight = FontWeight.SemiBold, + fontSize = 13.sp, + letterSpacing = (0.002).em, + lineHeight = 13.sp, + ), + detail1 = TextStyle( + fontFamily = PretendardRegular, + fontWeight = FontWeight.Normal, + fontSize = 13.sp, + letterSpacing = (0.002).em, + lineHeight = (15.6).sp, + ), + detail2 = TextStyle( + fontFamily = PretendardLight, + fontWeight = FontWeight.Light, + fontSize = 12.sp, + letterSpacing = (0.002).em, + lineHeight = (14.4).sp, + ), + detail3 = TextStyle( + fontFamily = PretendardLight, + fontWeight = FontWeight.Light, + fontSize = 11.sp, + letterSpacing = (0.002).em, + lineHeight = (13.2).sp, + ), + detail4 = TextStyle( + fontFamily = PretendardLight, + fontWeight = FontWeight.Light, + fontSize = 10.sp, + letterSpacing = (0.002).em, + lineHeight = 10.sp, + ), + detail5 = TextStyle( + fontFamily = PretendardLight, + fontWeight = FontWeight.Light, + fontSize = 9.sp, + letterSpacing = (0.002).em, + lineHeight = 9.sp, + ), + calendar = TextStyle( + fontFamily = PretendardRegular, + fontWeight = FontWeight.Normal, + fontSize = 15.sp, + letterSpacing = (0.002).em, + lineHeight = 15.sp, + ), + ) +} diff --git a/core/src/main/java/com/terning/core/ui/theme/Color.kt b/core/src/main/java/com/terning/core/ui/theme/Color.kt deleted file mode 100644 index 847dcc821..000000000 --- a/core/src/main/java/com/terning/core/ui/theme/Color.kt +++ /dev/null @@ -1,11 +0,0 @@ -package com.terning.core.ui.theme - -import androidx.compose.ui.graphics.Color - -val Purple80 = Color(0xFFD0BCFF) -val PurpleGrey80 = Color(0xFFCCC2DC) -val Pink80 = Color(0xFFEFB8C8) - -val Purple40 = Color(0xFF6650a4) -val PurpleGrey40 = Color(0xFF625b71) -val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/ui/theme/Theme.kt b/core/src/main/java/com/terning/core/ui/theme/Theme.kt deleted file mode 100644 index f826a9f05..000000000 --- a/core/src/main/java/com/terning/core/ui/theme/Theme.kt +++ /dev/null @@ -1,57 +0,0 @@ -package com.terning.core.ui.theme - -import android.os.Build -import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.darkColorScheme -import androidx.compose.material3.dynamicDarkColorScheme -import androidx.compose.material3.dynamicLightColorScheme -import androidx.compose.material3.lightColorScheme -import androidx.compose.runtime.Composable -import androidx.compose.ui.platform.LocalContext - -private val DarkColorScheme = darkColorScheme( - primary = Purple80, - secondary = PurpleGrey80, - tertiary = Pink80 -) - -private val LightColorScheme = lightColorScheme( - primary = Purple40, - secondary = PurpleGrey40, - tertiary = Pink40 - - /* Other default colors to override - background = Color(0xFFFFFBFE), - surface = Color(0xFFFFFBFE), - onPrimary = Color.White, - onSecondary = Color.White, - onTertiary = Color.White, - onBackground = Color(0xFF1C1B1F), - onSurface = Color(0xFF1C1B1F), - */ -) - -@Composable -fun TerningAndroidTheme( - darkTheme: Boolean = isSystemInDarkTheme(), - // Dynamic color is available on Android 12+ - dynamicColor: Boolean = true, - content: @Composable () -> Unit -) { - val colorScheme = when { - dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - val context = LocalContext.current - if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) - } - - darkTheme -> DarkColorScheme - else -> LightColorScheme - } - - MaterialTheme( - colorScheme = colorScheme, - typography = Typography, - content = content - ) -} \ No newline at end of file diff --git a/core/src/main/java/com/terning/core/ui/theme/Type.kt b/core/src/main/java/com/terning/core/ui/theme/Type.kt deleted file mode 100644 index bb904414b..000000000 --- a/core/src/main/java/com/terning/core/ui/theme/Type.kt +++ /dev/null @@ -1,34 +0,0 @@ -package com.terning.core.ui.theme - -import androidx.compose.material3.Typography -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.sp - -// Set of Material typography styles to start with -val Typography = Typography( - bodyLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 16.sp, - lineHeight = 24.sp, - letterSpacing = 0.5.sp - ) - /* Other default text styles to override - titleLarge = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Normal, - fontSize = 22.sp, - lineHeight = 28.sp, - letterSpacing = 0.sp - ), - labelSmall = TextStyle( - fontFamily = FontFamily.Default, - fontWeight = FontWeight.Medium, - fontSize = 11.sp, - lineHeight = 16.sp, - letterSpacing = 0.5.sp - ) - */ -) \ No newline at end of file diff --git a/core/src/main/res/font/pretendard_light.otf b/core/src/main/res/font/pretendard_light.otf new file mode 100644 index 000000000..228679e93 Binary files /dev/null and b/core/src/main/res/font/pretendard_light.otf differ diff --git a/core/src/main/res/font/pretendard_medium.otf b/core/src/main/res/font/pretendard_medium.otf new file mode 100644 index 000000000..057506983 Binary files /dev/null and b/core/src/main/res/font/pretendard_medium.otf differ diff --git a/core/src/main/res/font/pretendard_regular.otf b/core/src/main/res/font/pretendard_regular.otf new file mode 100644 index 000000000..08bf4cfc2 Binary files /dev/null and b/core/src/main/res/font/pretendard_regular.otf differ diff --git a/core/src/main/res/font/pretendard_semibold.otf b/core/src/main/res/font/pretendard_semibold.otf new file mode 100644 index 000000000..e7e36abc4 Binary files /dev/null and b/core/src/main/res/font/pretendard_semibold.otf differ diff --git a/feature/src/main/java/com/terning/feature/main/MainActivity.kt b/feature/src/main/java/com/terning/feature/main/MainActivity.kt index 655098740..69e533721 100644 --- a/feature/src/main/java/com/terning/feature/main/MainActivity.kt +++ b/feature/src/main/java/com/terning/feature/main/MainActivity.kt @@ -4,7 +4,7 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge -import com.terning.core.ui.theme.TerningAndroidTheme +import com.terning.core.designsystem.theme.TerningTheme import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint @@ -14,7 +14,7 @@ class MainActivity : ComponentActivity() { enableEdgeToEdge() setContent { val navigator: MainNavigator = rememberMainNavigator() - TerningAndroidTheme { + TerningTheme { MainScreen(navigator) } }