ppizarror / pygame-menu

A menu for pygame. Simple, and easy to use
https://pygame-menu.readthedocs.io/
Other
544 stars 141 forks source link

The color of the button text does not change #433

Closed Merklins closed 1 year ago

Merklins commented 1 year ago

Hi, I think I found a bug or I'm doing something wrong, I change the color of the button text, but it doesn't change in any way, I made an underscore of the same color and everything works, but there are problems with the text color.

TEST.zip

image

Merklins commented 1 year ago

When I added the second button, the text color was already displayed correctly on the button. image

TEST.zip

ppizarror commented 1 year ago

Hi! The problem relies on the selection effect rather than the color of the widget. The default selection effect belongs to HighlightSelection, which uses selection color (255, 255, 255), therefore you see a white text instead of the red (first example you sent).

However, if set the selection effect to None:

theme_menu = pygame_menu.themes.THEME_DEFAULT.copy()
theme_menu.widget_selection_effect = None
menu = pygame_menu.Menu(..., theme=theme_menu)
menu.add.button('Quit', font_size=40, underline=True, underline_color=(255, 0, 0), font_color=(255, 0, 0))

You get: asdf

Merklins commented 1 year ago

Thank you!