#42 Good colors
This commit is contained in:
		
							parent
							
								
									3d3a263855
								
							
						
					
					
						commit
						b8510d89c5
					
				
					 3 changed files with 10 additions and 87 deletions
				
			
		|  | @ -1,80 +0,0 @@ | |||
| package be.ugent.sel.studeez.common | ||||
| 
 | ||||
| import androidx.compose.material.Colors | ||||
| import androidx.compose.material.MaterialTheme | ||||
| import androidx.compose.runtime.Composable | ||||
| import androidx.compose.ui.graphics.Color | ||||
| import androidx.compose.ui.graphics.toArgb | ||||
| import androidx.core.graphics.ColorUtils | ||||
| 
 | ||||
| // Contains all colours that are used in the app. Currenlty, only light-theme colours are available. | ||||
| // Reference colour palette: https://xd.adobe.com/view/3cb1e6ff-eb42-4a74-886e-7739c2ccc5ed-69e2/ | ||||
| // Use colours by calling (for example) | ||||
| // ColorPalette.HIGH_EMPHASIS.onPrimary | ||||
| 
 | ||||
| // TODO Delete this class as we are now using ui.theme.Theme | ||||
| class ColorPalette { | ||||
|     companion object { | ||||
|         // Use High emphasis colours if the thing is important. | ||||
|         val HIGH_EMPHASIS: Colors = Colors( | ||||
|             isLight = true, | ||||
|             primary =           Color( 30, 100, 200, 255), | ||||
|             primaryVariant =    Color( 27,  90, 180, 255), | ||||
|             secondary =         Color(255, 210,   0, 255), | ||||
|             secondaryVariant =  Color(253, 217,  49, 255), | ||||
|             background =        Color.White, | ||||
|             surface =           Color.White, | ||||
|             error =             Color(176,   0,  32, 255), | ||||
|             onPrimary =         Color.White, | ||||
|             onSecondary =       Color.Black, | ||||
|             onBackground =      Color.Black, | ||||
|             onSurface =         Color.Black, | ||||
|             onError =           Color.White | ||||
|         ) | ||||
| 
 | ||||
|         // Use medium emphasis colours if the thing is less important | ||||
|         // or when another thing is selected while this one is not. | ||||
|         val MEDIUM_EMPHASIS: Colors = Colors( | ||||
|             isLight = true, | ||||
|             primary =           Color( 30, 100, 200, 188), | ||||
|             primaryVariant =    Color( 27,  90, 180, 188), | ||||
|             secondary =         Color(255, 210,   0, 188), | ||||
|             secondaryVariant =  Color(253, 217,  49, 188), | ||||
|             background =        Color(255, 255, 255, 188), | ||||
|             surface =           Color(255, 255, 255, 188), | ||||
|             error =             Color(176,   0,  32, 188), | ||||
|             onPrimary =         Color(255, 255, 255, 188), | ||||
|             onSecondary =       Color(  0,   0,   0, 188), | ||||
|             onBackground =      Color(  0,   0,   0, 188), | ||||
|             onSurface =         Color(  0,   0,   0, 188), | ||||
|             onError =           Color(255, 255, 255, 188) | ||||
|         ) | ||||
| 
 | ||||
|         // Use disabled colours if the thing is disabled, probably a button. | ||||
|         val DISABLED: Colors = Colors( | ||||
|             isLight = true, | ||||
|             primary =           Color( 30, 100, 200,  97), | ||||
|             primaryVariant =    Color( 27,  90, 180,  97), | ||||
|             secondary =         Color(255, 210,   0,  97), | ||||
|             secondaryVariant =  Color(253, 217,  49,  97), | ||||
|             background =        Color(255, 255, 255,  97), | ||||
|             surface =           Color(255, 255, 255,  97), | ||||
|             error =             Color(176,   0,  32,  97), | ||||
|             onPrimary =         Color(255, 255, 255,  97), | ||||
|             onSecondary =       Color(  0,   0,   0,  97), | ||||
|             onBackground =      Color(  0,   0,   0,  97), | ||||
|             onSurface =         Color(  0,   0,   0,  97), | ||||
|             onError =           Color(255, 255, 255,  97) | ||||
|         ) | ||||
| 
 | ||||
|         // Experimental function to darken colours if needed. | ||||
|         fun darken(color: Color, amount: Float): Color { | ||||
|             return Color(ColorUtils.blendARGB(color.toArgb(), Color.Black.toArgb(), amount)) | ||||
|         } | ||||
| 
 | ||||
|         // Experimental function to lighten colours if needed. | ||||
|         fun lighten(color: Color, amount: Float): Color { | ||||
|             return Color(ColorUtils.blendARGB(color.toArgb(), Color.White.toArgb(), amount)) | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -1,10 +1,12 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!-- Keep these colors here for the sake of safety, so Android can fall back on them --> | ||||
| <!-- All coloring of Jetpack Compose components should be done through using the StudeezTheme. --> | ||||
| <resources> | ||||
|     <color name="purple_200">#FFBB86FC</color> | ||||
|     <color name="purple_500">#FF6200EE</color> | ||||
|     <color name="purple_700">#FF3700B3</color> | ||||
|     <color name="teal_200">#FF03DAC5</color> | ||||
|     <color name="teal_700">#FF018786</color> | ||||
|     <color name="blue_100">#FF1E64C8</color> | ||||
|     <color name="blue_110">#FF1B5AB4</color> | ||||
|     <color name="blue_120">#FF1850A0</color> | ||||
|     <color name="yellow_100">#FFFFD200</color> | ||||
|     <color name="yellow_080">#FFFDD931</color> | ||||
|     <color name="black">#FF000000</color> | ||||
|     <color name="white">#FFFFFFFF</color> | ||||
| </resources> | ||||
|  | @ -1,7 +1,8 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
| 
 | ||||
|     <!-- This is the color of the statusBar (the bar with the clock and the notifications), | ||||
|         which we cannot set using Jetpack Compose --> | ||||
|     <style name="Theme.Studeez" parent="android:Theme.Material.Light.NoActionBar"> | ||||
|         <item name="android:statusBarColor">@color/purple_700</item> | ||||
|         <item name="android:statusBarColor">@color/blue_120</item> | ||||
|     </style> | ||||
| </resources> | ||||
		Reference in a new issue