DavinE
Feb 06, 2021 - 21:22
Is it possible to change the placeholder color ?
in my case its very dark so i can't read it very well...
Is it possible to change the placeholder color ?
in my case its very dark so i can't read it very well...
@DavinE try
from objc_util import *
import ui
tf = ui.TextField()
t = 'test'
tf.placeholder = t
tf.present('sheet')
@on_main_thread
def x():
o = ObjCInstance(tf)
stro=ObjCClass('NSMutableAttributedString').alloc().initWithString_(tf.placeholder)
color = UIColor.colorWithRed_green_blue_alpha_(1, 0.7, 0.7, 1)
stro.addAttribute_value_range_(ns('NSColor'),color,NSRange(0,len(t)))
o.textField().setAttributedPlaceholder_(stro)
#print(dir(o.textField()))
x()

@cvp it works great thanks xD