Railtypes dropdown menu: Bug with colored text

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

Railtypes dropdown menu: Bug with colored text

Post by Snail »

Hi all,

This started as a message for Peter1138, but I wonder if anyone else might have a solution for it.

In my trackset, I changed the color of certain keywords in the railtypes dropdown menu text.
Now, it seems there is an issue with that. When I highlight a row in that menu, the black text usually "reverses" to white. However, the black text displayed "after" some colored words doesn't "reverse" anymore, therefore appearing unreadable when highlighted:
ng text bug.png
ng text bug.png (22.63 KiB) Viewed 1477 times

You can see here that the closed parenthesis, as well as the max speed info, can't be read in the highlighted row.

I'm coding my set with m4nfo, and the text for the line I'm highlighting in the screenshot is as follows:

Code: Select all

"Metric gauge line construction (axle weight: " T_ORANGE "11t" T_BLACK ")",
It looks like the T_BLACK keyword results in text that's always black, and doesn't turn white in the highlighted row.
I even tried other syntaxes, such as:

Code: Select all

"Metric gauge line construction (axle weight: " T_PUSH T_ORANGE "11t" T_POP ")",
using T_PUSH and T_POP, but to no avail.
What would you suggest me to use in conjunction with (or as a replacement to) T_BLACK in my code?

Thanks in advance
The French Narrow Gauge Train Set is now released! Get it here
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Railtypes dropdown menu: Bug with colored text

Post by planetmaker »

AFAIK and IMHO: The menus were never supposed to have coloured text - though it might make sense to a certain degree.

But please look at your screenshot and overthink the use of so many colours and especially their choice. The amount of highlights is at the upper end of being useful. The contrast, and thus readibility, especially at string start is bad.

The solution to your problem should probably not be coloured text but preview sprites (like for vehicles etc)
User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

Re: Railtypes dropdown menu: Bug with colored text

Post by Snail »

Thank you for your suggestion. However, this doesn't answer my question.
I'll just summarize it again here. What syntax should I use (if any) to write black text that reverses in a highlighted menu row?
The French Narrow Gauge Train Set is now released! Get it here
User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

Re: Railtypes dropdown menu: Bug with colored text

Post by Snail »

Update: it turns out it was the OTTD version I was using. Mine was 1.9.1, and this feature got implemented in newgrfs only in April 2019, so later than that (it was initially only included in game scripts).
On a newer version of OTTD, such as 1.10.0, it works as intended.

Thanks to Frosch and Eddi for their help :)

As for the colors not being easily readable, I'll have another look into that. I might need to change those greys (those relating to power source) to something more easily readable on the grey background.
The French Narrow Gauge Train Set is now released! Get it here
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 10 guests