Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make bright peer name colors a bit more readable by applying a dark background #255

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ var emojis_cat_all_gropued: ArrayList<ArrayList<ArrayList<EmojiStrAndName>>> = A
var emojis_cat_all_cat_names: ArrayList<String> = ArrayList()
var emojis_cat_all_cat_emoji: ArrayList<String> = ArrayList()
const val emojis_per_row = 6
const val NGC_PEER_LUMINANCE_THRESHOLD_FOR_SHADOW = 0.85f // 0.935f // 0.733f // 0.935f
const val NGC_PEER_LUMINANCE_THRESHOLD_FOR_SHADOW = 0.733 // 0.85f // 0.935f // 0.733f // 0.935f
const val NGC_PEER_SHADOW_COLOR = 0xFF444444
val ImageloaderDispatcher = Executors.newFixedThreadPool(5).asCoroutineDispatcher()
var global_semaphore_contactlist_ui = CustomSemaphore(1)
var global_semaphore_grouppeerlist_ui = CustomSemaphore(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Outline
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.luminance
Expand Down Expand Up @@ -150,9 +151,16 @@ inline fun GroupChatMessage(isMyMessage: Boolean, groupmessage: UIGroupMessage,
// println("NNN:" + groupmessage.user.name + "CCC:" +groupmessage.user.color.luminance())
Text(
text = groupmessage.user.name,
modifier = if (groupmessage.user.color.luminance() > NGC_PEER_LUMINANCE_THRESHOLD_FOR_SHADOW)
Modifier.background(Color(NGC_PEER_SHADOW_COLOR), RoundedCornerShape(30)).padding(3.dp)
else
Modifier,
fontFamily = DefaultFont,
style = MaterialTheme.typography.body1.copy(
shadow = if (groupmessage.user.color.luminance() > NGC_PEER_LUMINANCE_THRESHOLD_FOR_SHADOW) Shadow(Color.Black, offset = Offset.Zero, blurRadius = 2.4f) else Shadow(),
//shadow = if (groupmessage.user.color.luminance() > NGC_PEER_LUMINANCE_THRESHOLD_FOR_SHADOW)
// Shadow(Color.Black, offset = Offset.Zero, blurRadius = 2.1f)
//else
// Shadow() ,
fontWeight = FontWeight.SemiBold,
lineHeight = TextUnit.Unspecified,
letterSpacing = 0.sp,
Expand Down
Loading