wesnoth / haldric

Wesnoth 2.0, being developed in the Godot engine.
https://www.wesnoth.org
368 stars 48 forks source link

Refactored _get_red_to_green_color function #128

Closed Elvish-Hunter closed 4 years ago

Elvish-Hunter commented 4 years ago

While I was testing Haldric, I noticed that the colors of the health bar in the side panel... didn't look too good. This is caused by the fact that a simple RGB calculation usually doesn't produce decent results. This PR replaces the RGB calculations in _get_red_to_green_color() with a relative ratio, which in turn is used to pick a color for the health bar (or anything else that might need it, like terrain defense labels). The five colors used here are green, lime, yellow, orange and red. The attached picture shows the final result. haldric-health-bars

Byteron commented 4 years ago

Thanks!