|
| 1 | +<h3 align="center"> |
| 2 | + <img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/logos/exports/1544x1544_circle.png" width="100" alt="Logo"/><br/> |
| 3 | + <img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/> |
| 4 | + Catppuccin Android Library |
| 5 | + <img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/> |
| 6 | +</h3> |
| 7 | + |
| 8 | +<p align="center"> |
| 9 | + <img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/palette/macchiato.png" width="400" /> |
| 10 | +</p> |
| 11 | + |
| 12 | + |
| 13 | +<p align="center"> |
| 14 | + <a href="https://jitpack.io/#ShiftHackZ/Catppuccin-Android-Library"> |
| 15 | + <img src="https://jitpack.io/v/ShiftHackZ/Catppuccin-Android-Library.svg" /> |
| 16 | + </a> |
| 17 | +</p> |
| 18 | + |
| 19 | +<p align="center"> |
| 20 | +Catppuccin Android Library provides a fast and easy way for Android Developers to implement <a href="https://github.com/catppuccin/catppuccin">Catppuccin</a> pastel theme in Android Applications. |
| 21 | +</p> |
| 22 | + |
| 23 | +<p align="center"> |
| 24 | + <img src="https://raw.githubusercontent.com/ShiftHackZ/Catppuccin-Android-Library/main/docs/assets/catppuccin1.png" width="220" /> |
| 25 | + <img src="https://raw.githubusercontent.com/ShiftHackZ/Catppuccin-Android-Library/main/docs/assets/catppuccin2.png" width="220" /> |
| 26 | + <img src="https://raw.githubusercontent.com/ShiftHackZ/Catppuccin-Android-Library/main/docs/assets/catppuccin3.png" width="220" /> |
| 27 | +</p> |
| 28 | + |
| 29 | +## 💭 Library structure |
| 30 | + |
| 31 | +The library is divided into separate modules, so you can implement only those that you need in your app for certain feature implementation. |
| 32 | + |
| 33 | +To implement this library, add jitpack.io repository in your project level build.gradle: |
| 34 | + |
| 35 | +``` |
| 36 | +buildscript { |
| 37 | + repositories { |
| 38 | + maven { setUrl("https://jitpack.io") } |
| 39 | + } |
| 40 | +} |
| 41 | +``` |
| 42 | + |
| 43 | +Then add all or only needed library module dependencies to your module level build gradle: |
| 44 | + |
| 45 | +``` |
| 46 | +dependencies { |
| 47 | + implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:palette:<VERSION>' |
| 48 | + implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:compose:<VERSION>' |
| 49 | + implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:splashscreen:<VERSION>' |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +### Palette |
| 54 | + |
| 55 | +Implements Catppuccin color palette: Catppuccin.Latte, Catppuccin.Frappe, Catppuccin.Macchiato, Catppuccin.Mocha. |
| 56 | + |
| 57 | +``` |
| 58 | +implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:palette:<VERSION>' |
| 59 | +``` |
| 60 | + |
| 61 | +### Compose |
| 62 | + |
| 63 | +Implements Android Jetpack Compose Catppuccin material themes. |
| 64 | + |
| 65 | +``` |
| 66 | +implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:compose:<VERSION>' |
| 67 | +``` |
| 68 | + |
| 69 | +### Splashscreen |
| 70 | + |
| 71 | +Implements basic XML themes for `androidx.core.core-splashscreen` library: |
| 72 | +- Theme.Catppuccin.Latte.SplashScreen |
| 73 | +- Theme.Catppuccin.Frappe.SplashScreen |
| 74 | +- Theme.Catppuccin.Macchiato.SplashScreen |
| 75 | +- Theme.Catppuccin.Mocha.SplashScreen |
| 76 | + |
| 77 | +``` |
| 78 | +implementation 'com.github.ShiftHackZ.Catppuccin-Android-Library:splashscreen:<VERSION>' |
| 79 | +``` |
| 80 | + |
| 81 | +## 👾 Examples |
| 82 | + |
| 83 | +### Palette |
| 84 | + |
| 85 | +To pick needed color from the Catppuccin Palette call `Catppuccin.<Flavor>.<Color>`, for example: |
| 86 | + |
| 87 | +```kotlin |
| 88 | +@Composable |
| 89 | +fun RedText(text: String) { |
| 90 | + val color = Catppuccin.Frappe.Red |
| 91 | + Text( |
| 92 | + text = text, |
| 93 | + color = color, |
| 94 | + ) |
| 95 | +} |
| 96 | +``` |
| 97 | + |
| 98 | +### Compose material themes |
| 99 | + |
| 100 | +#### Themes overview |
| 101 | + |
| 102 | +To pick needed theme form Catppuccin material themes call `CatppuccinTheme.<Theme>`, there are 3 available themes: |
| 103 | +- `CatppuccinTheme.DarkLightPalette` - takes two Catppuccin Paletes for dark and light mode and handles theming. |
| 104 | +- `CatppuccinTheme.Palette` - takes Catpuccin Palette and handles theming. |
| 105 | +- `CatppuccinTheme.Custom` - allows to define theme with fully custom ColorScheme, Typography, Shapes. |
| 106 | + |
| 107 | +To theme the whole application, you can follow this example code in your Activity: |
| 108 | + |
| 109 | +```kotlin |
| 110 | +class CatppuccinActivity : ComponentActivity() { |
| 111 | + |
| 112 | + override fun onCreate(savedInstanceState: Bundle?) { |
| 113 | + super.onCreate(savedInstanceState) |
| 114 | + setContent { |
| 115 | + CatppuccinTheme.Palette( |
| 116 | + palette = Catppuccin.Frappe, |
| 117 | + ) { |
| 118 | + // Put your composable content here. |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +#### Theme Palette customization |
| 126 | + |
| 127 | +There is a quick way to customize theme palette with certain main material colors (primary, secondary, etc). |
| 128 | + |
| 129 | +For this purpose construct your palette by call `CatppuccinMaterial.<Flavor>()`, for example: |
| 130 | + |
| 131 | +```kotlin |
| 132 | +class CatppuccinActivity : ComponentActivity() { |
| 133 | + |
| 134 | + override fun onCreate(savedInstanceState: Bundle?) { |
| 135 | + super.onCreate(savedInstanceState) |
| 136 | + setContent { |
| 137 | + CatppuccinTheme.Palette( |
| 138 | + palette = CatppuccinMaterial.Frappe( |
| 139 | + primary = Catppuccin.Frappe.Blue, |
| 140 | + secondary = Catppuccin.Frappe.Lavender, |
| 141 | + ) |
| 142 | + ) { |
| 143 | + // Put your composable content here. |
| 144 | + } |
| 145 | + } |
| 146 | + } |
| 147 | +} |
| 148 | +``` |
| 149 | + |
| 150 | +### Splashscreen |
| 151 | + |
| 152 | +The splashscreen module implements basic Catppuccin styles to theme `androidx.core.core-splashscreen` library. |
| 153 | + |
| 154 | +Core splashscreen documentation can be found here: [https://developer.android.com/develop/ui/views/launch/splash-screen](https://developer.android.com/develop/ui/views/launch/splash-screen) |
| 155 | + |
| 156 | +To define your custom your custom Splash theme, you can set as a parent `Theme.Catppuccin.<Flavor>.SplashScreen`, there are 4 themes available: |
| 157 | +- Theme.Catppuccin.Latte.SplashScreen |
| 158 | +- Theme.Catppuccin.Frappe.SplashScreen |
| 159 | +- Theme.Catppuccin.Macchiato.SplashScreen |
| 160 | +- Theme.Catppuccin.Mocha.SplashScreen |
| 161 | + |
| 162 | +Example of SplashTheme: |
| 163 | + |
| 164 | +```xml |
| 165 | +<style name="Theme.App.Starting" parent="Theme.Catppuccin.Frappe.SplashScreen"> |
| 166 | + <item name="windowSplashScreenAnimatedIcon">@drawable/catppuccin</item> |
| 167 | + <item name="windowSplashScreenAnimationDuration">500</item> |
| 168 | + <item name="postSplashScreenTheme">@style/Theme.Catppuccin</item> |
| 169 | +</style> |
| 170 | +``` |
| 171 | + |
| 172 | +Then define this theme in `android:theme` attribute in AndroidManifest.xml inside <application> or <activity> tag, for example: |
| 173 | + |
| 174 | +```xml |
| 175 | +... |
| 176 | +<application |
| 177 | + ... |
| 178 | + android:theme="@style/Theme.Catppuccin.Splash"> |
| 179 | + ... |
| 180 | +</application> |
| 181 | +... |
| 182 | +``` |
| 183 | + |
| 184 | +### ❤️ Gratitude |
| 185 | + |
| 186 | +Thanks to the [Catppuccin community](https://github.com/catppuccin/catppuccin) for this amazing soothing pastel theme which is the only theme that is pleasant to my eyes. |
| 187 | + |
| 188 | + |
| 189 | +<br><br><br> |
| 190 | + |
| 191 | +<p align="center"><img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/footers/gray0_ctp_on_line.svg?sanitize=true" /></p> |
| 192 | +<p align="center">Copyright © 2023-present <a href="https://moroz.cc" target="_blank">Dmitriy Moroz</a>, <a href="https://github.com/catppuccin" target="_blank">Catppuccin Org</a> |
| 193 | +<p align="center"><a href="https://github.com/catppuccin/catppuccin/blob/main/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=302d41&colorB=b7bdf8"/></a></p> |
0 commit comments