I created a rounded TextInput, however I can only change the color of the general panel, I want to change the text color in the TextInput separately so that it is better visible even with an opaque RoundedRectangle window
And if I change the command to rgba: .4, .2, .8, 1
, that is, I remove the transparency, the text will not be visible at all
test.py:
'''
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
class Screeen(Screen):
pass
class Manager(ScreenManager):
pass
sm = Builder.load_file("test.kv")
class appApp(App):
def build(self):
return sm
if __name__ == "__main__":
appApp().run()
'''
test.kv:
'''
Manager:
Screeen:
<RoundedTextInput@TextInput>
background_color: 0,0,1,0
canvas.before:
Color:
rgba: .4, .2, .8, .5
RoundedRectangle:
size: self.size
pos: self.pos
radius: [24]
<Screeen>:
name: "Screeen"
FloatLayout:
size: root.width, root.height
RoundedTextInput:
size_hint: (.45, .1)
pos: root.width * 1 / 4 , root.height * 1 / 2
'''
if someone is too have this problem i founded answer on it. I a little changed code:
test.kv:
Manager:
Screeen:
<RoundedTextInput@TextInput>
background_color: 0,0,1,0
canvas.before:
Color:
rgba: .4, .2, .2, 1 # here change color TEXT
<Screeen>:
name: "Screeen"
FloatLayout:
size: root.width, root.height
BoxLayout:
size_hint: (.45, .1)
pos: root.width * 1 / 4 , root.height * 1 / 2
canvas.after:
Color:
rgba: .2, .2, 1, 1 # here change color background textinput
RoundedRectangle:
size: self.size
pos: self.pos
radius: [24]
RoundedTextInput:
size_hint: (.45, .1)
pos: root.width * 1 / 4 , root.height * 1 / 2