adam-codersgu / supernova

A Kotlin-based Android application that allows the user to play music from their device while custom animations fall over the album artwork of the currently playing song.
0 stars 0 forks source link

Source colours from the theme and apply opacity values programmatically #69

Closed adam-codersgu closed 1 year ago

adam-codersgu commented 1 year ago

Currently, the colors.xml file contains multiple entries for the same colour but with varying opacity values e.g.

<color name="onSurface">#FFFFFF</color>
<color name="onSurface60">#99FFFFFF</color>

It would be preferable to have a single colour resource for the base colour (no opacity value), list the colour in the appropriate place(s) in the themes.xml file(s) (if necessary), then programmatically apply opacity as required. An example of how to do this can be seen in RecyclerViewScrollbar.kt

val defaultThumbOffColour = MaterialColors.getColor(context, R.attr.colorOnSurface, Color.LTGRAY)
// 84% Alpha
val defaultThumbOffColour84 = MaterialColors.compositeARGBWithAlpha(defaultThumbOffColour, 214)
adam-codersgu commented 1 year ago

Working on branch enhancement/colour_resources

adam-codersgu commented 1 year ago

Completed and merged https://github.com/adam-codersgu/supernova/pull/81