openplanet-nl / issues

Issue tracker for Openplanet.
10 stars 0 forks source link

UI::ButtonColored(string label, vec3 hsv) #439

Open sylae opened 6 months ago

sylae commented 6 months ago

Currently ButtonColored() takes h,s,v values as three separate floats. It'd be nice if there was an alternate signature that took these as a vec3, which would provide easier interop with UI::ToHSV and friends.

As it stands, some styling actions (such as colored buttons that "default" to the user's imgui style) are rather clunky:

vec3 hsv;
if (someCondition) {
  hsv.x = 1;
  hsv.y = 1;
  hsv.z = 1;
} else { // use normal imgui colors
  hsv = UI::ToHSV(UI::GetStyleColor(UI::Col::Button).x, UI::GetStyleColor(UI::Col::Button).y, UI::GetStyleColor(UI::Col::Button).z)
}

if (UI::ButtonColored("label", hsv.x, hsv.y, hsv.z)) {
  // do stuff
}