Skip to content

Latest commit

Β 

History

History
294 lines (222 loc) Β· 25.8 KB

README.md

File metadata and controls

294 lines (222 loc) Β· 25.8 KB

cover

π™Άπš˜πš˜πšπš•πšŽ-π™ΌπšŠπšπšŽπš›πš’πšŠπš•-π™³πšŽπšœπš’πšπš—-𝟹

πšƒπš‘πšŽ πš›πšŽπš™πš˜πšœπš’πšπš˜πš›πš’ πš™πš›πš˜πšŸπš’πšπšŽπšœ πšŒπš˜πš–πš™πš›πšŽπš‘πšŽπš—πšœπš’πšŸπšŽ πš’πš—πšπš˜πš›πš–πšŠπšπš’πš˜πš— πš˜πš— πš‘πš˜πš  𝚝𝚘 πšŽπšπšπšŽπšŒπšπš’πšŸπšŽπš•πš’ πšžπšπš’πš•πš’πš£πšŽ π™ΌπšŠπšπšŽπš›πš’πšŠπš•-𝟹 πš πš’πšπš‘πš’πš— πšπš‘πšŽ π™ΉπšŽπšπš™πšŠπšŒπš” π™²πš˜πš–πš™πš˜πšœπšŽ πšπš›πšŠπš–πšŽπš πš˜πš›πš”. π™Έπš πš˜πšπšπšŽπš›πšœ 𝚊 πš πšŽπšŠπš•πšπš‘ 𝚘𝚏 πš”πš—πš˜πš πš•πšŽπšπšπšŽ πšŠπš—πš πš™πš›πšŠπšŒπšπš’πšŒπšŠπš• 𝚌𝚘𝚍𝚎 πšœπšŠπš–πš™πš•πšŽπšœ πšπš‘πšŠπš πš’πš•πš•πšžπšœπšπš›πšŠπšπšŽ πšπš‘πšŽ πš™πš›πš’πš—πšŒπš’πš™πš•πšŽπšœ 𝚘𝚏 πšπš‘πšŽ π™ΌπšŠπšπšŽπš›πš’πšŠπš•-𝟹 πšπšŽπšœπš’πšπš—, πš›πšŽπšŒπšŽπš—πšπš•πš’ πš’πš—πšπš›πš˜πšπšžπšŒπšŽπš πš‹πš’ π™Άπš˜πš˜πšπš•πšŽ. π™±πš’ πšŽπš‘πš™πš•πš˜πš›πš’πš—πš πšπš‘πš’πšœ πš›πšŽπš™πš˜πšœπš’πšπš˜πš›πš’, πšπšŽπšŸπšŽπš•πš˜πš™πšŽπš›πšœ πšŒπšŠπš— πšπšŠπš’πš— 𝚊 πšπšŽπšŽπš™ πšžπš—πšπšŽπš›πšœπšπšŠπš—πšπš’πš—πš 𝚘𝚏 πšπš‘πšŽ πš’πš—πšπš›πš’πšŒπšŠπšŒπš’πšŽπšœ 𝚘𝚏 πš’πš—πšŒπš˜πš›πš™πš˜πš›πšŠπšπš’πš—πš π™ΌπšŠπšπšŽπš›πš’πšŠπš•-𝟹 πš’πš—πšπš˜ πšπš‘πšŽπš’πš› πš™πš›πš˜πš“πšŽπšŒπšπšœ πšŠπš—πš πšŽπš—πš‘πšŠπš—πšŒπšŽ πšπš‘πšŽπš’πš› πšŠπš‹πš’πš•πš’πšπš’ 𝚝𝚘 πšŒπš›πšŽπšŠπšπšŽ πšŸπš’πšœπšžπšŠπš•πš•πš’ πšŠπš™πš™πšŽπšŠπš•πš’πš—πš πšŠπš—πš πšŒπš˜πš‘πšŽπšœπš’πšŸπšŽ πšžπšœπšŽπš› πš’πš—πšπšŽπš›πšπšŠπšŒπšŽπšœ.


Contents
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ π™°πš—πšπš›πš˜πš’πš πš†πš’πšπšπšŽπš π™²πš˜πš–πš™πš˜πš—πšŽπš—πšπšœ
π™°πš‹πš˜πšžπš π™ΌπšŠπšπšŽπš›πš’πšŠπš•-𝟹
π™³πš’πš—πšŠπš–πš’πšŒ π™²πš˜πš•πš˜πš›πšœ
π™²πšŠπš— 𝚠𝚎 πšπš’πšœπšŠπš‹πš•πšŽ πšπš‘πšŽπšœπšŽ πšπš’πš—πšŠπš–πš’πšŒ πšŒπš˜πš•πš˜πš›πšœ
π™³πš’πšπšπšŽπš›πšŽπš—πšŒπšŽπšœ πš˜πš‹πšœπšŽπš›πšŸπšŽπš πšπš›πš˜πš– π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΈ 𝚝𝚘 π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ
π™Έπš–πš™πš˜πš›πšπšŠπš—πš πš•πš’πš—πš”πšœ
π™²πš˜πš•πš˜πš› πš‚πš’πšœπšπšŽπš–
π™·πš˜πš  𝚝𝚘 𝚞𝚜𝚎 πšπš˜πš˜πšπš•πšŽ πšπš‘πšŽπš–πšŽ πšœπšŽπš•πšŽπšŒπšπš˜πš› πšπš˜πš› π™ΌπšŠπšπšŽπš›πš’πšŠπš•-𝟹
πš‚πšŠπš–πš™πš•πšŽ πšπš‘πšŽπš–πšŽ πšπš’πš•πšŽ
πšƒπš’πš™πš˜πšπš›πšŠπš™πš‘πš’ πš’πš— π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ
πš‚πš‘πšŠπš™πšŽπšœ πš’πš— π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ
π™΄πš•πšŽπšŸπšŠπšπš’πš˜πš— πš’πš— π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ

π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ π™°πš—πšπš›πš˜πš’πš πš†πš’πšπšπšŽπš π™²πš˜πš–πš™πš˜πš—πšŽπš—πšπšœ

π™²πš˜πš—πšπšŽπš—πšπšœ
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ ‐ π™±πšžπšπšπš˜πš—πšœ
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ ‐ πšƒπšŽπš‘πšπ™΅πš’πšŽπš•πš
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ ‐ πš‚πšŽπš•πšŽπšŒπšπš’πš˜πš— πš„π™Έ πšŒπš˜πš–πš™πš˜πš—πšŽπš—πšπšœ
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ ‐ πš‚πš πš’πš™πšŠπš‹πš•πšŽ πšƒπšŠπš‹ 𝚁𝚘𝚠𝚜
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ - πšƒπš˜πš˜πš•πš‹πšŠπš›
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ - π™±πš˜πšπšπš˜πš– π™½πšŠπšŸπš’πšπšŠπšπš’πš˜πš— π™±πšŠπš›
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ - π™±πš˜πšπšπš˜πš– πš‚πš‘πšŽπšŽπš
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ - π™΄πš‘πš™πš˜πšœπšŽπšπ™³πš›πš˜πš™π™³πš˜πš πš— π™ΌπšŽπš—πšž
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ ‐ π™°πš•πšŽπš›πšπ™³πš’πšŠπš•πš˜πš
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ ‐ π™±πš˜πšπšπš˜πš–π™°πš™πš™π™±πšŠπš›
π™ΌπšŠπšπšŽπš›πš’πšŠπš•πŸΉ ‐ π™½πšŠπšŸπš’πšπšŠπšπš’πš˜πš—π™³πš›πšŠπš πšŽπš›
Light Theme Demo Dark Theme Demo
IMAGE ALT TEXT HERE IMAGE ALT TEXT HERE

π™°πš‹πš˜πšžπš π™ΌπšŠπšπšŽπš›πš’πšŠπš•-𝟹

  • 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

π™Έπš–πš™πš˜πš›πšπšŠπš—πš πš•πš’πš—πš”πšœ

π™Έπš–πš™πš˜πš›πšπšŠπš—πš πš•πš’πš—πš”πšœ
π™ΌπšŠπšπšŽπš›πš’πšŠπš•-𝟹
π™²πš˜πš•πš˜πš› πš‚πš’πšœπšπšŽπš–
π™³πš’πšπšπšŽπš›πšŽπš—πš πšŒπš˜πš•πš˜πš›πšœ πšŠπš—πš πš›πš˜πš•πšŽπšœ 𝚘𝚏 πšπš‘πšŽπš– 𝚞𝚜𝚎𝚍 πš’πš— πš πš’πšπšπšŽπšπšœ
π™ΌπšŠπšπšŽπš›πš’πšŠπš• πšƒπš‘πšŽπš–πšŽ π™±πšžπš’πš•πšπšŽπš›
π™Όπš’πšπš›πšŠπšπš’πš—πš πšπš›πš˜πš– π™ΌπšŠπšπšŽπš›πš’πšŠπš•-𝟸 𝚝𝚘 π™ΌπšŠπšπšŽπš›πš’πšŠπš•-𝟹

π™²πš˜πš•πš˜πš› πš‚πš’πšœπšπšŽπš–

π™²πš˜πš•πš˜πš› πš‚πš’πšœπšπšŽπš– π™²πš˜πš—πšπšŽπš—πšπšœ
π™ΊπšŽπš’ π™²πš˜πš•πš˜πš›πšœ
π™°πšŒπšŒπšŽπš—πš π™²πš˜πš•πš˜πš›πšœ
π™½πšŽπšžπšπš›πšŠπš• π™²πš˜πš•πš˜πš›πšœ
π™΄πš›πš›πš˜πš› π™²πš˜πš•πš˜πš›πšœ
π™Ώπš›πš˜πšπšžπšŒπš-πšœπš™πšŽπšŒπš’πšπš’πšŒ πšŒπšžπšœπšπš˜πš– π™²πš˜πš•πš˜πš›πšœ
π™Έπš—πšŸπšŽπš›πšœπšŽ π™²πš˜πš•πš˜πš›πšœ
π™½πšŽπšžπšπš›πšŠπš• π™²πš˜πš•πš˜πš›πšœ

KeyColors

π™ΊπšŽπš’ π™²πš˜πš•πš˜πš› π™½πšŠπš–πšŽ π™³πšŽπšœπšŒπš›πš’πš™πšπš’πš˜πš— πš˜πš— πš πš‘πšŽπš›πšŽ 𝚝𝚘 𝚞𝚜𝚎
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

Accent Colors

π™°πšŒπšŒπšŽπš—πš π™²πš˜πš•πš˜πš› π™½πšŠπš–πšŽ π™³πšŽπšœπšŒπš›πš’πš™πšπš’πš˜πš— πš˜πš— πš πš‘πšŽπš›πšŽ 𝚝𝚘 𝚞𝚜𝚎
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.
Buy Me A Coffee

π™²πš˜πš—πšπš›πš’πš‹πšžπšπšŽ πŸ™‹β€β™‚οΈ

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. ✌️

π™»πš’πšŒπšŽπš—πšœπšŽ Licence πŸ’³

This project is licensed under the Apache License 2.0 - see the LICENSE file for details