Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Colour/tint built-in Images
-
Hi All,
I'm 99.99% sure I've read something about changing the colour/tint of Pythonista's in-built images somewhere in this forum but I've spent a long time searching and can't find it. Hopefully this post will appear more easily in searches in the future with some appropriate tags for the benefit of others.
I thought changing the colour of the in-built images would be as simple as accessing the "tint" or "tin_color" attributes of the Image object but it isn't. It's actually a real pain in the proverbial. For those interested you can do so by using the ImageContext as follows:
import ui with ui.ImageContext(100, 100) as ctx: ui.set_color('red') img = ui.Image('iob:arrow_down_a_256').with_rendering_mode(ui.RENDERING_MODE_TEMPLATE).draw(0,0,100,100) img = ctx.get_image() img.show()
-
@m_doyle04, changing the tint works when the image is on a button, but not stand-alone:
from ui import * v = Button(image=Image('iob:arrow_down_a_256')) v.background_color = 'white' v.tint_color = 'red' v.present('sheet')
-
previous discussion here https://forum.omz-software.com/topic/3133/drawing-a-image-with-a-tint_color-in-an-imagecontext
-
@enceladus thanks, I knew I'd seen that somewhere before!