Questions tagged [tint]

223 questions
571
votes
29 answers

How to set tint for an image view programmatically in android?

Need to set tint for an image view... I am using it the following way: imageView.setColorFilter(R.color.blue,android.graphics.PorterDuff.Mode.MULTIPLY); But it doesn't change...
user2968768
111
votes
9 answers

MenuItem tinting on AppCompat Toolbar

When I use drawables from the AppCompat library for my Toolbar menu items the tinting works as expected. Like this:
mariusgreve
  • 2,621
  • 6
  • 23
  • 31
87
votes
16 answers

Lollipop's backgroundTint has no effect on a Button

I have a Button in my Activity, and I'd like it to have my theme's accent color. Instead of making my own drawables like we had to do pre-Lollipop, naturally I'd like to use the new backgroundTint attribute.
87
votes
13 answers

How would I tint an image programmatically on iOS?

I would like to tint an image with a color reference. The results should look like the Multiply blending mode in Photoshop, where whites would be replaced with tint: I will be changing the color value continuously. Follow up: I would put the code…
willc2
  • 38,991
  • 25
  • 88
  • 99
74
votes
13 answers

How to tint a transparent PNG image in iPhone?

I know it's possible to tint a rectangular image by drawing a CGContextFillRect over it and setting the blend mode. However, I can't figure out how to do a tint on a transparent image such as an icon. It must be possible since the SDK does it itself…
anna
  • 2,723
  • 4
  • 28
  • 37
69
votes
10 answers

How do I change the tint of an ImageButton on focus/press

I have an ImageButton in my app and I need to change the tint of the image when the button is pressed/focused. I have the ImageButton set to get its src from an XML file which as follows:
Joseph Earl
  • 23,351
  • 11
  • 76
  • 89
63
votes
6 answers

How can I tint a background image with CSS?

I have a background image set up through CSS. html { background-image: url('../img/cello.jpg'); background-attachment: fixed; background-size: 100%; } I plan on having a different background image for different pages of the website: so it's…
user1623053
  • 633
  • 1
  • 5
  • 5
62
votes
5 answers

Darkening an image with CSS (In any shape)

So I have seen quite a few ways to darken images with CSS, including ones with rounded corners, but my problem is different. Let's say I have an .png image that looks like a little dog (just go with it, I don't have any good examples), when I place…
Josiah
  • 4,663
  • 2
  • 31
  • 49
52
votes
8 answers

Android: Tint using DrawableCompat

I'm trying to tint an image prior to Android API level 21. I've successfully tinted items using: However, I can't seem to figure out how to do this through code on an ImageView: Drawable iconDrawable =…
Hippopatimus
  • 531
  • 1
  • 4
  • 5
41
votes
5 answers

Change colour of dark grey highlight when holding down custom UIButton?

I have a custom UIButton which is a cloud, transparent black and white .png file, with no down state, just one image. When tapping and holding the finger over it, it turns dark grey. I'm trying to change that dark grey to something a little less…
Luke
  • 9,512
  • 15
  • 82
  • 146
38
votes
1 answer

DrawableCompat tinting does not work on pre-Lollipop

I'm using the new TextInputLayout to wrap an EditText. When I determine a field has an error I do the following: Drawable drawable = DrawableCompat.wrap(getEditText().getBackground()); DrawableCompat.setTintList(drawable,…
Jason T.
  • 637
  • 1
  • 6
  • 12
32
votes
5 answers

How can I tint a UIImage with gradient?

I searched everywhere but didn't find the solution. I have image 1. How can I programatically tint them with gradient to get images 2 and 3? Here are those images: Tints that I applied to them via Photoshop are simple 2-color linear gradients. And…
akashivskyy
  • 44,342
  • 16
  • 106
  • 116
26
votes
4 answers

How to tint a Bitmap to a solid color

How would one go about tinting a Bitmap to a solid color, effectively replacing all pixels that have an alpha > 0 to a given RGB value? In addition how to do the same thing, but keeping the alpha for every pixel? I'm not looking for per-pixel…
Will Kru
  • 5,164
  • 3
  • 28
  • 41
26
votes
3 answers

Tint bitmap in layer-list

No longer relevant! This issue is related to a bug in old Android 4.x build. android:tint should now work correctly as in the example below I'm trying to apply tint to bitmap inside < layer-list >
somerandomusername
  • 1,993
  • 4
  • 23
  • 55
23
votes
6 answers

What does the number next to a color mean?

I'm reading this article about material design. In the list of colors, there is a number next to each color that seems to darken the color as its value goes up. What does this number means, more precisely? Edit: As all the answers are about the hex…
Ashkan Sarlak
  • 7,124
  • 6
  • 39
  • 51
1
2 3
14 15