diff options
Diffstat (limited to 'scene/resources/default_theme/default_theme.cpp')
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index aa271e6f4b..894936acd7 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -887,12 +887,65 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_icon("shape_rect", "ColorPicker", icons["picker_shape_rectangle"]); theme->set_icon("shape_rect_wheel", "ColorPicker", icons["picker_shape_rectangle_wheel"]); theme->set_icon("add_preset", "ColorPicker", icons["add"]); - theme->set_icon("color_hue", "ColorPicker", icons["color_picker_hue"]); theme->set_icon("sample_bg", "ColorPicker", icons["mini_checkerboard"]); theme->set_icon("overbright_indicator", "ColorPicker", icons["color_picker_overbright"]); theme->set_icon("bar_arrow", "ColorPicker", icons["color_picker_bar_arrow"]); theme->set_icon("picker_cursor", "ColorPicker", icons["color_picker_cursor"]); + { + const int precision = 7; + + Ref<Gradient> hue_gradient; + hue_gradient.instantiate(); + PackedFloat32Array offsets; + offsets.resize(precision); + PackedColorArray colors; + colors.resize(precision); + + for (int i = 0; i < precision; i++) { + float h = i / float(precision - 1); + offsets.write[i] = h; + colors.write[i] = Color::from_hsv(h, 1, 1); + } + hue_gradient->set_offsets(offsets); + hue_gradient->set_colors(colors); + + Ref<GradientTexture2D> hue_texture; + hue_texture.instantiate(); + hue_texture->set_width(800); + hue_texture->set_height(6); + hue_texture->set_gradient(hue_gradient); + + theme->set_icon("color_hue", "ColorPicker", hue_texture); + } + + { + const int precision = 7; + + Ref<Gradient> hue_gradient; + hue_gradient.instantiate(); + PackedFloat32Array offsets; + offsets.resize(precision); + PackedColorArray colors; + colors.resize(precision); + + for (int i = 0; i < precision; i++) { + float h = i / float(precision - 1); + offsets.write[i] = h; + colors.write[i] = Color::from_ok_hsl(h, 1, 0.5); + } + hue_gradient->set_offsets(offsets); + hue_gradient->set_colors(colors); + + Ref<GradientTexture2D> hue_texture; + hue_texture.instantiate(); + hue_texture->set_width(800); + hue_texture->set_height(6); + hue_texture->set_gradient(hue_gradient); + + theme->set_icon("color_okhsl_hue", "ColorPicker", hue_texture); + } + // ColorPickerButton theme->set_icon("bg", "ColorPickerButton", icons["mini_checkerboard"]); |