[2.0.69] Revisit label prototypes for parent hovered color (core)

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
TBC_x
Inserter
Inserter
Posts: 27
Joined: Sun Sep 10, 2023 5:20 am
Contact:

[2.0.69] Revisit label prototypes for parent hovered color (core)

Post by TBC_x »

I'm implementing custom inventory GUI and the inherited style of count_label sets parent_hovered_font_color to black (also game_controller_hovered_font_color), which turns my item counts black. That attribute is inherited by every single label style

parent_hovered_font_color beats hovered_font_color

The only workaround is to split the tree up
from:

Code: Select all

button (inventory_slot)
β”œβ”€β”€ sprite
β”œβ”€β”€ request_count (count_label)
└── item_count (count_label)
to:

Code: Select all

container
β”œβ”€β”€ button (inventory_slot)
β”‚Β Β  └── sprite
└── count_container
    β”œβ”€β”€ request_count (count_label)
    └── item_count (count_label)
But this solution is off by a pixel on certain UI scales and unnecessarily complex to implement
I would add a custom label prototype, but I'm doing this for a scenario
inventory-item.png
inventory-item.png (4.62 KiB) Viewed 78 times
The gui above:

Code: Select all

container
β”œβ”€β”€ button (inventory_slot)
β”‚Β Β  β”œβ”€β”€ sprite
β”‚Β Β  └── fake_count (count_label)
└── count_container
    β”œβ”€β”€ request_count (count_label)
    └── item_count (count_label)
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5423
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [2.0.69] Revisit label prototypes for parent hovered color (core)

Post by Klonan »

I guess this request can boil down to:

Expose a LuaStyle::parent_hovered_font_color which is similar to the already existing LuaStyle::font_color

Also maybe a shot in the dark, have you tried putting the count inside a rich text tag that sets the color you want? I think think it might make it immune to the parent hovered font color
TBC_x
Inserter
Inserter
Posts: 27
Joined: Sun Sep 10, 2023 5:20 am
Contact:

Re: [2.0.69] Revisit label prototypes for parent hovered color (core)

Post by TBC_x »

Rich text is an acceptable workaround, that actually works
Post Reply

Return to β€œModding interface requests”