Configuration options for color picker layout/style
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
**Is your feature request related to a problem? Please describe.**
Using `egui::widgets::color_picker::color_picker_hsva_2d` (or similar) by itself results in a color slider that's much smaller than the row with the drag values:

This is because the color area draws its size from `style.spacing.slider_with` (which is slightly unintuitive if you haven't looked at the code / know that the area is a slider). This can be scaled up in a child UI
```rust
ui.scope(|ui| {
ui.spacing_mut().slider_width = 220.0;
egui::widgets::color_picker::color_picker_hsva_2d(
ui,
&mut egui_color,
egui::color_picker::Alpha::Opaque,
);
});
```
to get reasonable results:

However, I don't actually need the ability to change the color format or to copy the color, and would prefer to keep the color slider small.
**Describe the solution you'd like**
I would like the ability to configure the style and layout of the color picker widget, so that you can specify:
- the size of the color slider in a more explicit fashion
- whether or not the color format is shown
- whether or not the copy button is shown
- whether or not the raw values of the color are shown
I suspect the best way to do this would be to convert it into a formal `Widget` so that it can be configured and placed as the user requires.
In addition to this, breaking apart the widget into its constituent components and exposing them would help users pick and choose what they want. For example, making `color_slider_2d` (or its `Widget` equivalent) public would be perfect for what I need.
**Describe alternatives you've considered**
The only solution I can see that would work externally would be to copy the code from `egui` or to fork it, neither of which is ideal. A short-term fix would be to make all of the relevant constituent functions public, so that they can be used without using the full `color_picker`.
**Additional context**
I believe the disparity in size between the color picker and the value row was exacerbated by #2734.
Contributor guide
Research direction
Start with the public color_picker_hsva_2d entry point and inspect how it uses the color slider and surrounding controls. Review the related color_slider_2d reference in the issue, then determine how configurable sizing, format/value display, and copy-button options should be exposed. Done means users can select the desired layout without copying or forking egui code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100