mirror of
https://github.com/JetBrains/intellij-platform-plugin-template.git
synced 2025-12-05 14:21:55 +00:00
Extract Weather colors to WeatherAppColor object
This commit is contained in:
parent
07ab7b2f05
commit
291a35b6bd
@ -0,0 +1,12 @@
|
|||||||
|
package org.jetbrains.plugins.template.weatherApp
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
object WeatherAppColors {
|
||||||
|
val nightWeatherColor = Color(0xFF1A237E)
|
||||||
|
val coldWeatherColor = Color(0xFF3F51B5)
|
||||||
|
val coolWeatherColor = Color(0xFF5E35B1)
|
||||||
|
val mildWeatherColor = Color(0xFF039BE5)
|
||||||
|
val warmWeatherColor = Color(0xFFFF9800)
|
||||||
|
val hotWeatherColor = Color(0xFFE91E63)
|
||||||
|
}
|
||||||
@ -182,12 +182,12 @@ fun isNightTime(dateTime: LocalDateTime): Boolean {
|
|||||||
*/
|
*/
|
||||||
fun getCardColorByTemperature(temperature: Float, isNightTime: Boolean): Color {
|
fun getCardColorByTemperature(temperature: Float, isNightTime: Boolean): Color {
|
||||||
return when {
|
return when {
|
||||||
isNightTime -> Color(0xFF1A237E) // Dark blue for night
|
isNightTime -> WeatherAppColors.nightWeatherColor
|
||||||
temperature < 0 -> Color(0xFF3F51B5) // Cold: blue
|
temperature < 0 -> WeatherAppColors.coldWeatherColor
|
||||||
temperature < 10 -> Color(0xFF5E35B1) // Cool: purple
|
temperature < 10 -> WeatherAppColors.coolWeatherColor
|
||||||
temperature < 20 -> Color(0xFF039BE5) // Mild: light blue
|
temperature < 20 -> WeatherAppColors.mildWeatherColor
|
||||||
temperature < 30 -> Color(0xFFFF9800) // Warm: orange
|
temperature < 30 -> WeatherAppColors.warmWeatherColor
|
||||||
else -> Color(0xFFE91E63) // Hot: pink/red
|
else -> WeatherAppColors.hotWeatherColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user