Skip to content

Instantly share code, notes, and snippets.

@G00fY2
Created November 16, 2020 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save G00fY2/ce88eb2dc2ee68f25b4a292571321f97 to your computer and use it in GitHub Desktop.
Save G00fY2/ce88eb2dc2ee68f25b4a292571321f97 to your computer and use it in GitHub Desktop.
Android DeviceDefault AccentColor
var accentColor = Color.WHITE
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
context.obtainStyledAttributes(
android.R.style.ThemeOverlay_DeviceDefault_Accent_DayNight,
intArrayOf(android.R.attr.colorAccent)
).also {
accentColor = it.getColor(0, accentColor)
}.recycle()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment