The International Simutrans Forum

 

Author Topic: New parameter to use a single color in player texts.  (Read 1000 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1622
    • Simutrans-BLOG
  • Languages: ES
New parameter to use a single color in player texts.
« on: May 12, 2020, 10:55:21 PM »

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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10663
  • Languages: De,EN,JP
Re: New parameter to use a single color in player texts.
« Reply #1 on: May 15, 2020, 02:18:36 PM »
This defies the meaning of player colors though ...

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1622
    • Simutrans-BLOG
  • Languages: ES
Re: New parameter to use a single color in player texts.
« Reply #2 on: May 15, 2020, 04:40:57 PM »
This 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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10663
  • Languages: De,EN,JP
Re: New parameter to use a single color in player texts.
« Reply #3 on: May 16, 2020, 12:23:54 AM »
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.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1622
    • Simutrans-BLOG
  • Languages: ES
Re: New parameter to use a single color in player texts.
« Reply #4 on: May 16, 2020, 12:34:45 AM »
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.
Wow, I find this very interesting, I will try as soon as I have some time. :D

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1622
    • Simutrans-BLOG
  • Languages: ES
Re: New parameter to use a single color in player texts.
« Reply #5 on: May 16, 2020, 02:27:53 AM »
Much better contrast now, great! .  8)

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1622
    • Simutrans-BLOG
  • Languages: ES
Re: New parameter to use a single color in player texts.
« Reply #6 on: May 16, 2020, 12:08:55 PM »
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)
Code: [Select]
--- /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;

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1622
    • Simutrans-BLOG
  • Languages: ES
Re: New parameter to use a single color in player texts.
« Reply #7 on: May 18, 2020, 01:12:29 PM »
I wonder if I should create a new topic for patch color brightness player?.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10663
  • Languages: De,EN,JP
Re: New parameter to use a single color in player texts.
« Reply #8 on: May 18, 2020, 01:50:05 PM »
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

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1622
    • Simutrans-BLOG
  • Languages: ES
Re: New parameter to use a single color in player texts.
« Reply #9 on: May 18, 2020, 09:10:53 PM »
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
« Last Edit: May 21, 2020, 04:33:28 PM by Isaac.Eiland-Hall »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10663
  • Languages: De,EN,JP
Re: New parameter to use a single color in player texts.
« Reply #10 on: May 19, 2020, 03:02:13 PM »
Thank you