Skip to content

Instantly share code, notes, and snippets.

@alvindizon
Last active August 17, 2020 08:51
Show Gist options
  • Save alvindizon/480165bc27930b1ff98463f8f0e263b9 to your computer and use it in GitHub Desktop.
Save alvindizon/480165bc27930b1ff98463f8f0e263b9 to your computer and use it in GitHub Desktop.
day/night mode drawable notes
<!-- If you are using a drawable on an imageview on a layout, -->
<!-- in order for the night color values to take effect, use/reference color attributes in this manner: -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?attr/colorOnSurface"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>
<!-- you can ?attr/colorControlNormal, ?attr/colorPrimary or whatever color attribute -->
<!-- Referencing colors directly from colors.xml won't work -->
<!-- using tint and alpha **might** override your night mode color, not sure about this -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment