| 1 |
package io.oxygenhub.android.ui.theme |
| 2 |
|
| 3 |
import androidx.compose.material3.MaterialTheme |
| 4 |
import androidx.compose.runtime.Composable |
| 5 |
import androidx.compose.ui.graphics.Color |
| 6 |
|
| 7 |
/** |
| 8 |
* What an icon stands for, in the hub's colours (#25), as its pages tint |
| 9 |
* theirs: the accent for things you open (repositories, folders, account |
| 10 |
* details), purple for releases, projects and pending things, the status |
| 11 |
* colours for what passed, failed or is open. Each reads on both palettes. |
| 12 |
*/ |
| 13 |
object Tones { |
| 14 |
val repository: Color @Composable get() = MaterialTheme.colorScheme.primary |
| 15 |
val folder: Color @Composable get() = MaterialTheme.colorScheme.primary |
| 16 |
val info: Color @Composable get() = MaterialTheme.colorScheme.primary |
| 17 |
val release: Color @Composable get() = MaterialTheme.colorScheme.tertiary |
| 18 |
val project: Color @Composable get() = MaterialTheme.colorScheme.tertiary |
| 19 |
val pending: Color @Composable get() = MaterialTheme.colorScheme.tertiary |
| 20 |
val restricted: Color @Composable get() = LocalStatusColors.current.warn |
| 21 |
val plain: Color @Composable get() = MaterialTheme.colorScheme.onSurfaceVariant |
| 22 |
|
| 23 |
/** A notification's kind (the hub's `notify` kinds). */ |
| 24 |
@Composable |
| 25 |
fun of(kind: String): Color { |
| 26 |
val s = LocalStatusColors.current |
| 27 |
return when { |
| 28 |
kind == "flow.failed" || kind == "backup" -> s.bad |
| 29 |
kind == "flow.fixed" || kind == "backup.recovered" -> s.ok |
| 30 |
kind.startsWith("proposal.review") -> MaterialTheme.colorScheme.tertiary |
| 31 |
kind.endsWith(".comment") || kind == "mention" -> MaterialTheme.colorScheme.primary |
| 32 |
kind.startsWith("proposal") || kind.startsWith("issue") -> s.ok |
| 33 |
else -> MaterialTheme.colorScheme.primary |
| 34 |
} |
| 35 |
} |
| 36 |
} |