Published in


Change the Colour of my Notification!

Photo by Ronald Cuyan on Unsplash

Have a look at my other post about android notifications too.

When I was working on notifications on my sample android project, I realised that my notification icon does not have the colours that the original image has. I went back to the original document to see what I missed but couldn’t find any difference in there. Then I started digging. Here what I found!

The small icon appears in MONOCHROME in the status bar

monochrome: a photograph or picture developed or executed in black and white or in varying tones of only one colour.

The page states that the icon of the notification in the status bar cannot have a colour. You have just 2 options;

  • <item name=”android:windowLightStatusBar”>false</item>
  • <item name=”android:windowLightStatusBar”>true</item>

Have a look at this nice q/a.

What about ‘setSmallIcon’?

It is at least letting you change its colour but don’t expect much. The image that you set is not expected to have colour. Even if it has colour it is going to be ignored. Have a look at this link.

Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray.

Let’s see how out icon looks like when we change its colour.

Without setting colour
With setting colour

Rainbow time! ‘setLargeIcon’

You have the freedom to use as much colour as you want for a large image. The only thing is that you need a bitmap object for that. You can use the following code for that. (It is not only for vector drawables.)

fun generateBitmapFromVectorDrawable(context: Context, drawableId: Int): Bitmap {
val drawable = ContextCompat.getDrawable(context, drawableId) as Drawable
val bitmap = Bitmap.createBitmap(

val canvas = Canvas(bitmap)
drawable.setBounds(0, 0, canvas.width, canvas.height)

return bitmap

Background colour

Android Setup notification is a good sample of background colour

Changing background colour of a notification is possible with the version Oreo. It is used with the method ‘setColorized(Boolean)’. This flag is false by default. When it is set to true, the colour you set by ‘setColor’ method is used for your background colour. Before going too excited I have to stop you. It is only for foreground service notifications. Therefore, even if you set your colorized flag to true if your notification is just a simple notification that isn’t attached to a foreground service, it is not going to change the background colour of your notification.

Also, have a look at the sample project for notifications. You can find most of the code that I tell in this post.

It is all about colours in android notifications. Do not forget to give some claps and follow me. 👏 Leave a comment and if there is any missing/wrong part feel free to harshly correct me.




The (retired) Pub(lication) for Android & Tech, focused on Development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
efe budak

efe budak

Android Developer

More from Medium

Rebel Tech Stories: Looking back on my .NET internship

Video broadcast (WebRTC) using IONIC apps

Watch files on folder with Kotlin

Localazy localization tool from an Android developer perspective