-
Notifications
You must be signed in to change notification settings - Fork 0
[NDGL-30] 디자인 시스템 리소스 추가(typography, color, theme) #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
83 changes: 77 additions & 6 deletions
83
core/ui/src/main/java/com/yapp/ndgl/core/ui/theme/Color.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,82 @@ | ||
| package com.yapp.ndgl.core.ui.theme | ||
|
|
||
| import androidx.compose.runtime.Immutable | ||
| import androidx.compose.runtime.staticCompositionLocalOf | ||
| import androidx.compose.ui.graphics.Color | ||
|
|
||
| val Purple80 = Color(0xFFD0BCFF) | ||
| val PurpleGrey80 = Color(0xFFCCC2DC) | ||
| val Pink80 = Color(0xFFEFB8C8) | ||
| @Immutable | ||
| data class NDGLColors( | ||
| val white: Color = Color.Unspecified, | ||
|
|
||
| val Purple40 = Color(0xFF6650a4) | ||
| val PurpleGrey40 = Color(0xFF625b71) | ||
| val Pink40 = Color(0xFF7D5260) | ||
| val primary50: Color = Color.Unspecified, | ||
| val primary100: Color = Color.Unspecified, | ||
| val primary200: Color = Color.Unspecified, | ||
| val primary300: Color = Color.Unspecified, | ||
| val primary400: Color = Color.Unspecified, | ||
| val primary500: Color = Color.Unspecified, | ||
| val primary600: Color = Color.Unspecified, | ||
| val primary700: Color = Color.Unspecified, | ||
| val primary800: Color = Color.Unspecified, | ||
| val primary900: Color = Color.Unspecified, | ||
|
|
||
| val secondary50: Color = Color.Unspecified, | ||
| val secondary100: Color = Color.Unspecified, | ||
| val secondary200: Color = Color.Unspecified, | ||
| val secondary300: Color = Color.Unspecified, | ||
| val secondary400: Color = Color.Unspecified, | ||
| val secondary500: Color = Color.Unspecified, | ||
| val secondary600: Color = Color.Unspecified, | ||
| val secondary700: Color = Color.Unspecified, | ||
| val secondary800: Color = Color.Unspecified, | ||
| val secondary900: Color = Color.Unspecified, | ||
|
|
||
| val red50: Color = Color.Unspecified, | ||
| val red100: Color = Color.Unspecified, | ||
| val red200: Color = Color.Unspecified, | ||
| val red300: Color = Color.Unspecified, | ||
| val red400: Color = Color.Unspecified, | ||
| val red500: Color = Color.Unspecified, | ||
| val red600: Color = Color.Unspecified, | ||
| val red700: Color = Color.Unspecified, | ||
| val red800: Color = Color.Unspecified, | ||
| val red900: Color = Color.Unspecified, | ||
| ) | ||
|
|
||
| internal val ndglColors = NDGLColors( | ||
| white = Color(0xFFFFFFFF), | ||
|
|
||
| primary50 = Color(0xFFF0FFF4), | ||
| primary100 = Color(0xFFDCFFE4), | ||
| primary200 = Color(0xFFBEF5CB), | ||
| primary300 = Color(0xFF85E89D), | ||
| primary400 = Color(0xFF18B368), | ||
| primary500 = Color(0xFF28A745), | ||
| primary600 = Color(0xFF22863A), | ||
| primary700 = Color(0xFF176F2C), | ||
| primary800 = Color(0xFF165C26), | ||
| primary900 = Color(0xFF144620), | ||
|
|
||
| secondary50 = Color(0xFFF5F5F5), | ||
| secondary100 = Color(0xFFE6E6E6), | ||
| secondary200 = Color(0xFFD9D9D9), | ||
| secondary300 = Color(0xFFB3B3B3), | ||
| secondary400 = Color(0xFF757575), | ||
| secondary500 = Color(0xFF444444), | ||
| secondary600 = Color(0xFF383838), | ||
| secondary700 = Color(0xFF2C2C2C), | ||
| secondary800 = Color(0xFF1E1E1E), | ||
| secondary900 = Color(0xFF111111), | ||
|
|
||
| red50 = Color(0xFFFEF2F2), | ||
| red100 = Color(0xFFFFE2E2), | ||
| red200 = Color(0xFFFFC9C9), | ||
| red300 = Color(0xFFFFA2A2), | ||
| red400 = Color(0xFFFF6467), | ||
| red500 = Color(0xFFFB2C36), | ||
| red600 = Color(0xFFE7000B), | ||
| red700 = Color(0xFFC10007), | ||
| red800 = Color(0xFF9F0712), | ||
| red900 = Color(0xFF82181A), | ||
| ) | ||
|
|
||
| val LocalNDGLColors = staticCompositionLocalOf { NDGLColors() } |
83 changes: 41 additions & 42 deletions
83
core/ui/src/main/java/com/yapp/ndgl/core/ui/theme/Theme.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,57 +1,56 @@ | ||
| package com.yapp.ndgl.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.Typography | ||
| import androidx.compose.material3.lightColorScheme | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.platform.LocalContext | ||
| import androidx.compose.runtime.CompositionLocalProvider | ||
| import androidx.compose.runtime.ReadOnlyComposable | ||
|
|
||
| private val DarkColorScheme = darkColorScheme( | ||
| primary = Purple80, | ||
| secondary = PurpleGrey80, | ||
| tertiary = Pink80, | ||
| ) | ||
| object NDGLTheme { | ||
| val colors: NDGLColors | ||
| @Composable | ||
| @ReadOnlyComposable | ||
| get() = LocalNDGLColors.current | ||
|
|
||
| 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), | ||
| */ | ||
| ) | ||
| val typography: NDGLTypography | ||
| @Composable | ||
| @ReadOnlyComposable | ||
| get() = LocalNDGLTypography.current | ||
| } | ||
|
|
||
| @Composable | ||
| fun NDGLTheme( | ||
| 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) | ||
| } | ||
| CompositionLocalProvider( | ||
| LocalNDGLColors provides ndglColors, | ||
| LocalNDGLTypography provides ndglTypography, | ||
| ) { | ||
| val colorScheme = lightColorScheme( | ||
| primary = NDGLTheme.colors.primary500, | ||
| secondary = NDGLTheme.colors.secondary500, | ||
| background = NDGLTheme.colors.white, | ||
| surface = NDGLTheme.colors.white, | ||
| ) | ||
|
|
||
| darkTheme -> DarkColorScheme | ||
| else -> LightColorScheme | ||
| } | ||
| val typography = Typography( | ||
| headlineLarge = NDGLTheme.typography.titleLgBold, | ||
| headlineMedium = NDGLTheme.typography.titleMdBold, | ||
| titleLarge = NDGLTheme.typography.subtitleLgSemiBold, | ||
| titleMedium = NDGLTheme.typography.subtitleMdSemiBold, | ||
| bodyLarge = NDGLTheme.typography.bodyLgMedium, | ||
| bodyMedium = NDGLTheme.typography.bodyMdMedium, | ||
| bodySmall = NDGLTheme.typography.bodyMdRegular, | ||
| labelLarge = NDGLTheme.typography.bodySmSemiBold, | ||
| labelMedium = NDGLTheme.typography.bodySmMedium, | ||
| labelSmall = NDGLTheme.typography.bodySmRegular, | ||
| ) | ||
|
|
||
| MaterialTheme( | ||
| colorScheme = colorScheme, | ||
| typography = Typography, | ||
| content = content, | ||
| ) | ||
| MaterialTheme( | ||
| colorScheme = colorScheme, | ||
| typography = typography, | ||
| content = content, | ||
| ) | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
121 changes: 121 additions & 0 deletions
121
core/ui/src/main/java/com/yapp/ndgl/core/ui/theme/Typography.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| package com.yapp.ndgl.core.ui.theme | ||
|
|
||
| import androidx.compose.runtime.Immutable | ||
| import androidx.compose.runtime.staticCompositionLocalOf | ||
| 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.sp | ||
| import com.yapp.ndgl.core.ui.R | ||
|
|
||
| private val Pretendard = FontFamily( | ||
| Font(R.font.pretendard, FontWeight.Normal), | ||
| Font(R.font.pretendard, FontWeight.Medium), | ||
| Font(R.font.pretendard, FontWeight.SemiBold), | ||
| Font(R.font.pretendard, FontWeight.Bold), | ||
| ) | ||
|
|
||
| @Immutable | ||
| data class NDGLTypography( | ||
| val titleLgBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Bold, | ||
| fontSize = 32.sp, | ||
| ), | ||
| val titleLgSemiBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.SemiBold, | ||
| fontSize = 32.sp, | ||
| ), | ||
|
|
||
| val titleMdBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Bold, | ||
| fontSize = 22.sp, | ||
| ), | ||
| val titleMdSemiBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.SemiBold, | ||
| fontSize = 22.sp, | ||
| ), | ||
|
|
||
| val subtitleLgSemiBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.SemiBold, | ||
| fontSize = 20.sp, | ||
| ), | ||
| val subtitleLgMedium: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Medium, | ||
| fontSize = 20.sp, | ||
| ), | ||
|
|
||
| val subtitleMdBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Bold, | ||
| fontSize = 18.sp, | ||
| ), | ||
| val subtitleMdSemiBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.SemiBold, | ||
| fontSize = 18.sp, | ||
| ), | ||
| val subtitleMdMedium: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Medium, | ||
| fontSize = 18.sp, | ||
| ), | ||
|
|
||
| val bodyLgSemiBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.SemiBold, | ||
| fontSize = 16.sp, | ||
| ), | ||
| val bodyLgMedium: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Medium, | ||
| fontSize = 16.sp, | ||
| ), | ||
| val bodyLgRegular: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Normal, | ||
| fontSize = 16.sp, | ||
| ), | ||
|
|
||
| val bodyMdSemiBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.SemiBold, | ||
| fontSize = 14.sp, | ||
| ), | ||
| val bodyMdMedium: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Medium, | ||
| fontSize = 14.sp, | ||
| ), | ||
| val bodyMdRegular: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Normal, | ||
| fontSize = 14.sp, | ||
| ), | ||
|
|
||
| val bodySmSemiBold: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.SemiBold, | ||
| fontSize = 12.sp, | ||
| ), | ||
| val bodySmMedium: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Medium, | ||
| fontSize = 12.sp, | ||
| ), | ||
| val bodySmRegular: TextStyle = TextStyle( | ||
| fontFamily = Pretendard, | ||
| fontWeight = FontWeight.Normal, | ||
| fontSize = 12.sp, | ||
| ), | ||
| ) | ||
|
|
||
| internal val ndglTypography = NDGLTypography() | ||
|
|
||
| val LocalNDGLTypography = staticCompositionLocalOf { NDGLTypography() } | ||
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.