
๐ถ๐๐๐๐๐-๐ผ๐๐๐๐๐๐๐-๐ณ๐๐๐๐๐-๐น
๐๐๐ ๐๐๐๐๐๐๐๐๐๐ข ๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐ ๐๐ ๐๐๐ ๐๐ ๐๐๐๐๐๐๐๐๐๐๐ข ๐๐๐๐๐๐ฃ๐ ๐ผ๐๐๐๐๐๐๐-๐น ๐ ๐๐๐๐๐ ๐๐๐ ๐น๐๐๐๐๐๐ ๐ฒ๐๐๐๐๐๐ ๐๐๐๐๐๐ ๐๐๐. ๐ธ๐ ๐๐๐๐๐๐ ๐ ๐ ๐๐๐๐๐ ๐๐ ๐๐๐๐ ๐๐๐๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐๐ ๐๐๐๐ ๐๐๐๐๐๐๐ ๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐๐๐ ๐๐ ๐๐๐ ๐ผ๐๐๐๐๐๐๐-๐น ๐๐๐๐๐๐, ๐๐๐๐๐๐๐๐ข ๐๐๐๐๐๐๐๐๐๐ ๐๐ข ๐ถ๐๐๐๐๐. ๐ฑ๐ข ๐๐ก๐๐๐๐๐๐๐ ๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐ข, ๐๐๐๐๐๐๐๐๐๐ ๐๐๐ ๐๐๐๐ ๐ ๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐๐๐๐ ๐๐ ๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ผ๐๐๐๐๐๐๐-๐น ๐๐๐๐ ๐๐๐๐๐ ๐๐๐๐๐๐๐๐ ๐๐๐ ๐๐๐๐๐๐๐ ๐๐๐๐๐ ๐๐๐๐๐๐๐ข ๐๐ ๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐ข ๐๐๐๐๐๐๐๐๐ ๐๐๐ ๐๐๐๐๐๐๐๐ ๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐.
๐ผ๐๐๐๐๐๐๐๐น ๐ฐ๐๐๐๐๐๐ ๐๐๐๐๐๐ ๐ฒ๐๐๐๐๐๐๐๐๐
Light Theme Demo |
Dark Theme Demo |
 |
 |
๐ฐ๐๐๐๐ ๐ผ๐๐๐๐๐๐๐-๐น
- It is the new standard way of building the UI that Google recommends.
- In the past till now we used to use material-2 and the material-3 comes with new features
- A good feature that comes with material-3 is dynamic colors
๐ณ๐ข๐๐๐๐๐ ๐ฒ๐๐๐๐๐
- In android-12, we will know about these dynamic colors
- Android takes wallpaper or the color that you define as your wallpaper and generates a color theme around that. So all the apps that use material themes will generate your own theme based on the color of the wallpaper for your app
๐ฒ๐๐ ๐ ๐ ๐๐๐๐๐๐๐ ๐๐๐๐๐ ๐๐ข๐๐๐๐๐ ๐๐๐๐๐๐
- Yes this is optional, we can disable our application if this doesn't suit our design.
๐ณ๐๐๐๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐๐ ๐๐๐๐ ๐ผ๐๐๐๐๐๐๐๐ธ ๐๐ ๐ผ๐๐๐๐๐๐๐๐น
๐ผ๐๐๐๐๐๐๐๐ธ |
๐ผ๐๐๐๐๐๐๐๐น |
In the theme file we refer function blocks as lightColors and darkColors |
In the theme file we refer function blocks as lightColorScheme and darkColorScheme |
There is a primary variant color |
primary variant color is not there but primary,secondary,tertiary color is present |
| Dynamic colors are not present |
Dynamic colors are present |
๐ธ๐๐๐๐๐๐๐๐ ๐๐๐๐๐
๐ฒ๐๐๐๐ ๐๐ข๐๐๐๐

๐บ๐๐ข ๐ฒ๐๐๐๐ ๐ฝ๐๐๐ |
๐ณ๐๐๐๐๐๐๐๐๐๐ ๐๐ ๐ ๐๐๐๐ ๐๐ ๐๐๐ |
| Primary Key Color |
This is something bright and something that stands out, Say action button etc that enables user to click on it |
| Secodary Key Color |
This is usually based on primary key color that need to stand out but not as much as primary color |
| Tertiary Key Color |
This is same as primary and secondary but next lighter action |

๐ฐ๐๐๐๐๐ ๐ฒ๐๐๐๐ ๐ฝ๐๐๐ |
๐ณ๐๐๐๐๐๐๐๐๐๐ ๐๐ ๐ ๐๐๐๐ ๐๐ ๐๐๐ |
| On Primary |
This is a color that is on top of primary color. Say if a action button is there with primary color, the plus symbol on it will be on primary |
| Primary Container |
This is a color similar to primary color, Now we use this say a background for the floating action button. |
| On Primary Container |
This will the plus symbol color on the primary container color |

๐ฝ๐๐๐๐๐๐ ๐ฒ๐๐๐๐ ๐ฝ๐๐๐ |
๐ณ๐๐๐๐๐๐๐๐๐๐ ๐๐ ๐ ๐๐๐๐ ๐๐ ๐๐๐ |
| Background |
This will the color of the background, In case of list the padding area part that seperates list item from screen |
| OnBackground |
This will be if any color needs to be added on top of the background but out side the surface |
| Surface |
This will be the background color of the card view in a list |
| OnSurface |
This will be the color, if any view is added that has a background on top of the surface |

๐ด๐๐๐๐ ๐ฒ๐๐๐๐ ๐ฝ๐๐๐ |
๐ณ๐๐๐๐๐๐๐๐๐๐ ๐๐ ๐ ๐๐๐๐ ๐๐ ๐๐๐ |
| Error |
Usually we show error in this color, Say Snackbar indicating background color |
| On Error |
This color will be the text or icon color on top of error background color |
| Error Container |
This will be the background of say dialog that is displayed as error |
| On Error Container |
Again this will be the content that is displayed on top of error container color |
- This is basically the branding colors that we use are specifc to app, In Such a scenario, we use these custom specific colors

- This is used for some elements that is displayed on top of other surfaces.
- Used on top of the widgets such as snackbar

- Used on the borders of widgets and the content of it
๐ท๐๐ ๐๐ ๐๐๐ ๐๐๐๐๐๐ ๐๐๐๐๐ ๐๐๐๐๐๐๐๐ ๐๐๐ ๐ผ๐๐๐๐๐๐๐-๐น
- There are 2 types
Dynamic and Custom.
Dynamic is used to get the colors based on a image.
Custom is used to define colors based on a specific color.
- In the custom colors option we choose a primary color and based on the primary color the algorithm selects other colors, We can even give a specific touches for it.
๐๐๐๐๐๐ ๐๐๐๐๐ ๐๐๐๐
@Composable
fun MaterialAppTheme(
// Flag to determine the dark/light theme
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
// Parent most top level composable
content: @Composable () -> Unit
) {
// We need context here because the support for dynamic colors comes from android system
val context = LocalContext.current
val view = LocalView.current
// We can apply one of four different color scheme's depending on what type of device the user has.
// CONDITION-1:-> If the user is running on android-12 and above, We need to use dynamic colors.
// CONDITION-2:-> If the user is running on device prior to android-12, We will use normal material-2 theme.
// CONDITION-3:-> If the user again is using light theme, then we use light colors else use dark colors.
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
// CONDITION-1:-> If the user is running on android-12 and above, We need to use dynamic colors.
if (darkTheme){
// CONDITION-3:-> If the user again is using dark theme, then we use dark colors.
dynamicDarkColorScheme(context)
} else {
// CONDITION-3:-> If the user again is using light theme, then we use light colors.
dynamicLightColorScheme(context)
}
}
darkTheme -> {
// CONDITION-1:-> If the user is running on below android-12, We need to use material-2 colors.
// CONDITION-3:-> If the user again is using dark theme, then we use dark colors.
DarkColors
}
else -> {
// CONDITION-1:-> If the user is running on below android-12, We need to use material-2 colors.
// CONDITION-3:-> If the user again is using light theme, then we use light colors.
LightColors
}
}
// Set the color for the status bar
if (!view.isInEditMode) {
/* getting the current window by tapping into the Activity */
val currentWindow = (view.context as? Activity)?.window
?: throw Exception("Not in an activity - unable to get Window reference")
SideEffect {
/* the default code did the same cast here - might as well use our new variable! */
currentWindow.statusBarColor = colorScheme.primary.toArgb()
/* accessing the insets controller to change appearance of the status bar, with 100% less deprecation warnings */
WindowCompat.getInsetsController(currentWindow, view).isAppearanceLightStatusBars =
darkTheme
}
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
}
๐๐ข๐๐๐๐๐๐๐๐ข ๐๐ ๐ผ๐๐๐๐๐๐๐๐น
- Before
Material 3, there were 6 Headline variations, 2 Subtitle variations, 2 Body variations, Button, Caption, and Overline styles.
- How to use
headline,title,body,label, etc. More details on android documentation.
- In
Material 3, there is a more regular and smaller number of variants for each classification, namely Small, Medium, and Large.
๐ฒ๐๐๐๐๐๐๐๐๐ ๐๐ ๐ผ๐๐๐๐๐๐๐๐ธ ๐๐๐ ๐ผ๐๐๐๐๐๐๐๐น ๐๐๐ฃ๐๐ ๐๐๐ ๐๐๐๐๐ ๐๐๐๐๐๐๐๐๐๐ |
 |
๐๐๐๐๐๐ ๐๐ ๐ผ๐๐๐๐๐๐๐๐น
๐ด๐๐๐๐๐๐๐๐ ๐๐ ๐ผ๐๐๐๐๐๐๐๐น
๐๐๐๐๐๐๐ โ
If you feel like support me a coffee for my efforts, I would greatly appreciate it.

๐ฒ๐๐๐๐๐๐๐๐๐ ๐โโ๏ธ
Read contribution guidelines for more information regarding contribution.
๐ต๐๐๐๐๐๐๐ โ๏ธ
Feature requests are always welcome, File an issue here.
๐ต๐๐๐ ๐๐๐๐ ๐๐๐๐๐๐๐ ๐๐๐๐๐๐ ? โค๏ธ
Support it by clicking the โญ button on the upper right of this page. โ๏ธ
๐ป๐๐๐๐๐๐ :credit_card:
This project is licensed under the Apache License 2.0 - see the LICENSE file for details