Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3] Unify ColorPicker color mode slider colors #783

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions scene/gui/color_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,30 +254,27 @@ void ColorModeRAW::slider_draw(int p_which) {
left_color.a = 0;
right_color = color;
right_color.a = 1;

col.set(0, left_color);
col.set(1, right_color);
col.set(2, right_color);
col.set(3, left_color);
pos.set(0, Vector2(0, 0));
pos.set(1, Vector2(size.x, 0));
pos.set(2, Vector2(size.x, margin));
pos.set(3, Vector2(0, margin));

slider->draw_polygon(pos, col);
} else {
left_color = Color(
p_which == 0 ? 0 : color.r,
p_which == 1 ? 0 : color.g,
p_which == 2 ? 0 : color.b);
right_color = Color(
p_which == 0 ? 1 : color.r,
p_which == 1 ? 1 : color.g,
p_which == 2 ? 1 : color.b);
}
}

bool ColorModeRAW::apply_theme() const {
for (int i = 0; i < 4; i++) {
HSlider *slider = color_picker->get_slider(i);
slider->remove_theme_icon_override("grabber");
slider->remove_theme_icon_override("grabber_highlight");
slider->remove_theme_style_override("slider");
slider->remove_theme_constant_override("grabber_offset");
}
col.set(0, left_color);
col.set(1, right_color);
col.set(2, right_color);
col.set(3, left_color);
pos.set(0, Vector2(0, 0));
pos.set(1, Vector2(size.x, 0));
pos.set(2, Vector2(size.x, margin));
pos.set(3, Vector2(0, margin));

return true;
slider->draw_polygon(pos, col);
}

void ColorModeOKHSL::_value_changed() {
Expand Down
1 change: 0 additions & 1 deletion scene/gui/color_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ class ColorModeRAW : public ColorMode {
virtual Color get_color() const override;

virtual void slider_draw(int p_which) override;
virtual bool apply_theme() const override;

ColorModeRAW(ColorPicker *p_color_picker) :
ColorMode(p_color_picker){};
Expand Down
Loading