News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

New parameter to use a single color in player texts.

Started by Yona-TYT, May 12, 2020, 10:55:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT


Using the "player_name_text_unicolor" parameter to use a single color in player texts, in order to improve the contrast in some themes.

This is just a little experiment on my part, at the moment it only affects "ticker :: add_msg", if you agree I can do the same in other places, like network filters.

prissi

This defies the meaning of player colors though ...

Yona-TYT

Quote from: prissi on May 15, 2020, 02:18:36 PMThis defies the meaning of player colors though
Certainly, but it also gives the contrast I need for the dark theme.

It is the simplest solution, I think another solution would be to add shadows to the font, but that's something out of my reach I'm afraid.

prissi

The player colors have offsets. 0..7. 7 is the brightest, 0 the darkest. Thus a call "get_gui_player_color()" and "get_gui_player_color_rgb()" in the relevant places in simwin and simgui would take care of this. You just would configure the offset in the config.

Yona-TYT

Quote from: prissi on May 16, 2020, 12:23:54 AMThe player colors have offsets. 0..7. 7 is the brightest, 0 the darkest. Thus a call "get_gui_player_color()" and "get_gui_player_color_rgb()" in the relevant places in simwin and simgui would take care of this. You just would configure the offset in the config.
Wow, I find this very interesting, I will try as soon as I have some time. :D

Yona-TYT


Yona-TYT

I have added "env_t :: text_bright_player_color" to all texts with player colors. :P

Attached a patch, I hope everything is fine, greetings!. ;D




I ran into a contrast problem with value that shows the size of the vehicles in the depot, I would like to use the player color, I think it looks great.  8)
--- /home/yonatyt/simu-git/simutrans-master/gui/depot_frame.cc    2020-05-15 11:17:26.000000000 -0400
+++ /home/yonatyt/simu-git/files/depot_frame.cc    2020-05-16 07:29:51.575414859 -0400
@@ -474,7 +474,7 @@
     scrolly_convoi.set_pos(scr_coord(D_MARGIN_LEFT,CONVOI_VSTART));

     lb_convoi_number.set_width(30);
-    lb_convoi_number.set_color(COL_WHITE);
+    lb_convoi_number.set_color(color_idx_to_rgb(welt->get_active_player()->get_player_color1()+env_t::text_bright_player_color));

     // place for description text
     second_column_x = D_MARGIN_LEFT + (BUTTON_WIDTH_DEPOT+D_H_SPACE*2)*2;

Yona-TYT

I wonder if I should create a new topic for patch color brightness player?.

prissi

Button aloso needs different background with dark themese, I would think. SO two new parameters: gui_player_color_bright and gui_player_color_dark in r9106

Yona-TYT

#9
Thanks a lot !

@Prissi, it seems that you have forgotten to put default values in the themes.

Sorry for the double message.

What double message? ;-) --Isaac

prissi