Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

kivy - Kivymd App on Android has different colour icons to my Mac

I compiled the KivyMD app I've been coding onto my phone and I had to specify in the buildozer.spec requirements to use sdl2_ttf==2.0.15 for the MD icons to actually appear. However, all the icons are fully white even though they have a text colour set to 0, 0, 0, 1:

MDFloatingActionButton:
    icon: 'plus-circle-outline'
    elevation_normal: 10
    user_font_size: '20sp'
    text_color: 0, 0, 0, 1
    md_bg_color: 1, 1, 1, 1
    pos_hint: {'center_x': 0.8, 'y': 0.03}
    on_release: app.CreateNewWorkout_1_Dialog()

On my Mac:

enter image description here

On my phone:

enter image description here

It also changes some of the text on buttons and in MDTextFields. I thought it had something to do with the sdl2_ttf==2.0.15 and tried other versions but the icons would only appear on this version. Any help would be much appreciated!

question from:https://stackoverflow.com/questions/65901440/kivymd-app-on-android-has-different-colour-icons-to-my-mac

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Because when compiling, you are using the KivyMD library from the PyPi and not from the master branch.

This is a bug in the library. Do not use the value 0, 0, 0, 1. If you need a black icon color, you can set the value to 0, 0, 0, 0.9:

MDFloatingActionButton:
    text_color: 0, 0, 0, .9
    md_bg_color: 1, 1, 1, 1
    pos_hint: {'center_x': 0.8, 'y': 0.5}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...