Tweak some icon colors

This commit is contained in:
MM20 2022-06-18 19:13:00 +02:00
parent 6de89f3f79
commit e8936eb0b4
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
10 changed files with 34 additions and 31 deletions

View File

@ -3,7 +3,6 @@ package de.mm20.launcher2.search.data
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInstaller
import android.graphics.Color
import android.graphics.ColorMatrix
import android.graphics.ColorMatrixColorFilter
import android.graphics.drawable.BitmapDrawable
@ -33,9 +32,9 @@ class AppInstallation(
foregroundLayer = TintedIconLayer(
icon = ContextCompat.getDrawable(context, R.drawable.ic_file_android)!!,
scale = 0.5f,
color = Color.WHITE
color = 0xFF757575.toInt()
),
backgroundLayer = ColorLayer(ContextCompat.getColor(context, R.color.grey))
backgroundLayer = ColorLayer(0xFF757575.toInt())
)
}
@ -52,7 +51,7 @@ class AppInstallation(
foregroundLayer = StaticIconLayer(
icon = foreground,
),
backgroundLayer = ColorLayer(ContextCompat.getColor(context, R.color.grey))
backgroundLayer = ColorLayer(0xFF757575.toInt())
)
}

View File

@ -40,9 +40,9 @@ abstract class Application(
foregroundLayer = TintedIconLayer(
icon = ContextCompat.getDrawable(context, R.drawable.ic_file_android)!!,
scale = 0.5f,
color = Color.WHITE,
color = 0xff3dda84.toInt(),
),
backgroundLayer = ColorLayer(ContextCompat.getColor(context, R.color.android_green))
backgroundLayer = ColorLayer(0xff3dda84.toInt())
)
}

View File

@ -54,11 +54,11 @@ class AppShortcut(
override fun getPlaceholderIcon(context: Context): StaticLauncherIcon {
return StaticLauncherIcon(
foregroundLayer = TintedIconLayer(
color = Color.WHITE,
color = 0xFF3DDA84.toInt(),
icon = ContextCompat.getDrawable(context, R.drawable.ic_file_android)!!,
scale = 0.5f,
),
backgroundLayer = ColorLayer(ContextCompat.getColor(context, R.color.green)),
backgroundLayer = ColorLayer(0xFF3DDA84.toInt()),
)
}

View File

@ -37,9 +37,9 @@ class CalendarEvent(
return StaticLauncherIcon(
foregroundLayer = TextLayer(
text = df.format(startTime),
color = Color.WHITE
color = color
),
backgroundLayer = ColorLayer(getDisplayColor())
backgroundLayer = ColorLayer(color)
)
}
@ -47,11 +47,6 @@ class CalendarEvent(
val uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, id)
return Intent(Intent.ACTION_VIEW).setData(uri).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
fun getDisplayColor(): Int {
val palette = TonalPalette.fromInt(color)
return palette.tone(70)
}
}
data class UserCalendar(

View File

@ -43,8 +43,8 @@ class Contact(
if (firstName.isNotEmpty()) firstName[0].toString() else "" + if (lastName.isNotEmpty()) lastName[0].toString() else ""
return StaticLauncherIcon(
foregroundLayer = TextLayer(text = iconText, color = Color.WHITE),
backgroundLayer = ColorLayer(ContextCompat.getColor(context, R.color.blue))
foregroundLayer = TextLayer(text = iconText, color = 0xFF2364AA.toInt()),
backgroundLayer = ColorLayer(0xFF2364AA.toInt())
)
}
@ -64,7 +64,7 @@ class Contact(
foregroundLayer = StaticIconLayer(
icon = bmp.toDrawable(context.resources),
),
backgroundLayer = ColorLayer()
backgroundLayer = ColorLayer(0xFF2364AA.toInt())
)
}

View File

@ -53,7 +53,7 @@ abstract class File(
foregroundLayer = TintedIconLayer(
icon = ContextCompat.getDrawable(context, resId)!!,
scale = 0.5f,
color = Color.WHITE
color = ContextCompat.getColor(context, bgColor)
),
backgroundLayer = ColorLayer(ContextCompat.getColor(context, bgColor))
)

View File

@ -99,13 +99,13 @@ fun ShapedLauncherIcon(
IconLayer(
it.backgroundLayer,
size,
colorTone = if (!LocalDarkTheme.current) 30 else 90,
colorTone = if (LocalDarkTheme.current) 30 else 90,
MaterialTheme.colorScheme.primaryContainer
)
IconLayer(
it.foregroundLayer,
size,
colorTone = if (!LocalDarkTheme.current) 90 else 10,
colorTone = if (LocalDarkTheme.current) 90 else 10,
MaterialTheme.colorScheme.onPrimaryContainer
)
}

View File

@ -1,5 +1,6 @@
package de.mm20.launcher2.ui.settings.appearance
import android.graphics.drawable.ColorDrawable
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
@ -374,7 +375,11 @@ fun IconShapePreference(
)!!,
scale = 1.5f,
),
ColorLayer(LocalContext.current.getColor(R.color.ic_launcher_background))
backgroundLayer = StaticIconLayer(
icon = ColorDrawable(
LocalContext.current.getColor(R.color.ic_launcher_background)
)
)
),
onClick = {
onValueChanged(it)

View File

@ -38,9 +38,9 @@ class Website(
return StaticLauncherIcon(
foregroundLayer = StaticIconLayer(
icon = icon,
scale = 0.7f,
scale = 1f,
),
backgroundLayer = ColorLayer(color)
backgroundLayer = TransparentLayer
)
} catch (e: ExecutionException) {
return null
@ -49,19 +49,21 @@ class Website(
}
override fun getPlaceholderIcon(context: Context): StaticLauncherIcon {
val color = if (color != 0) color else 0xFFF76F8E.toInt()
if (label.isNotBlank()) {
return StaticLauncherIcon(
foregroundLayer = TextLayer(text = label[0].toString(), color = Color.WHITE),
backgroundLayer = ColorLayer(Color.LTGRAY)
foregroundLayer = TextLayer(text = label[0].toString(), color = color),
backgroundLayer = ColorLayer(color)
)
}
return StaticLauncherIcon(
foregroundLayer = StaticIconLayer(
foregroundLayer = TintedIconLayer(
icon = ContextCompat.getDrawable(context, R.drawable.ic_website)!!,
scale = 0.5f,
color = color,
),
backgroundLayer = ColorLayer(if (color != 0) color else Color.LTGRAY)
backgroundLayer = ColorLayer(color)
)
}

View File

@ -9,6 +9,7 @@ import androidx.core.content.ContextCompat
import de.mm20.launcher2.icons.ColorLayer
import de.mm20.launcher2.icons.StaticIconLayer
import de.mm20.launcher2.icons.StaticLauncherIcon
import de.mm20.launcher2.icons.TintedIconLayer
import de.mm20.launcher2.wikipedia.R
class Wikipedia(
@ -22,11 +23,12 @@ class Wikipedia(
override fun getPlaceholderIcon(context: Context): StaticLauncherIcon {
return StaticLauncherIcon(
foregroundLayer = StaticIconLayer(
foregroundLayer = TintedIconLayer(
icon = ContextCompat.getDrawable(context, R.drawable.ic_wikipedia)!!,
scale = 1f
scale = 1f,
color = 0xFFC1C2C4.toInt(),
),
backgroundLayer = ColorLayer(0xFFF0F0F0.toInt())
backgroundLayer = ColorLayer(0xFFC1C2C4.toInt())
)
}