-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
161 additions
and
33 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
app/src/main/java/xyz/wingio/dimett/ui/theme/AdditionalTheme.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package xyz.wingio.dimett.ui.theme | ||
|
||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.Stable | ||
import androidx.compose.runtime.compositionLocalOf | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.runtime.structuralEqualityPolicy | ||
import androidx.compose.ui.graphics.Color | ||
|
||
/** | ||
* Provides themed colors not available in [MaterialTheme] | ||
*/ | ||
@Stable | ||
class AdditionalColorScheme( | ||
favorite: Color, | ||
boost: Color | ||
) { | ||
|
||
var favorite by mutableStateOf(favorite, structuralEqualityPolicy()) | ||
private set | ||
|
||
var boost by mutableStateOf(boost, structuralEqualityPolicy()) | ||
private set | ||
|
||
} | ||
|
||
val LocalAdditionalColorScheme = compositionLocalOf<AdditionalColorScheme> { error("No AdditionalColorScheme specified") } | ||
|
||
val MaterialTheme.additionalColors: AdditionalColorScheme | ||
@Composable | ||
get() = LocalAdditionalColorScheme.current | ||
|
||
|
||
// Default color schemes | ||
|
||
val DarkAdditionalColorScheme = AdditionalColorScheme( | ||
favorite = HotPink, | ||
boost = Green | ||
) | ||
|
||
val LightAdditionalColorScheme = AdditionalColorScheme( | ||
favorite = HotPink100, | ||
boost = Green200 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package xyz.wingio.dimett.ui.theme | ||
|
||
import androidx.compose.ui.graphics.Color | ||
|
||
val HotPink = Color(0xFFFF0066) | ||
val HotPink100 = Color(0xFFE6005C) | ||
val HotPink200 = Color(0xFFCF0053) | ||
val HotPink300 = Color(0xFFCF0053) | ||
val HotPink400 = Color(0xFFBA004B) | ||
val HotPink500 = Color(0xFFA70044) | ||
val HotPink600 = Color(0xFF96003D) | ||
val HotPink700 = Color(0xFF870037) | ||
val HotPink800 = Color(0xFF7A0032) | ||
val HotPink900 = Color(0xFF6E002D) | ||
|
||
val Green = Color(0xFF71C87F) | ||
val Green100 = Color(0xFF66B472) | ||
val Green200 = Color(0xFF5CA267) | ||
val Green300 = Color(0xFF53925D) | ||
val Green400 = Color(0xFF4B8354) | ||
val Green500 = Color(0xFF44764C) | ||
val Green600 = Color(0xFF3D6A44) | ||
val Green700 = Color(0xFF375F3D) | ||
val Green800 = Color(0xFF325637) | ||
val Green900 = Color(0xFF2D4D32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
app/src/main/java/xyz/wingio/dimett/utils/ModifierUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package xyz.wingio.dimett.utils | ||
|
||
import androidx.compose.ui.Modifier | ||
|
||
/** | ||
* Applies additional modifiers when the [predicate] is met | ||
* | ||
* @param predicate Condition for applying additional modifiers | ||
*/ | ||
fun Modifier.thenIf(predicate: Boolean, block: Modifier.() -> Modifier) = | ||
if(predicate) then(block()) else this |