ZIm/crates/ui/src
Nate Butler 6767e98e00
ui: Color cleanup (#26673)
This PR cleans up some color & elevation misc.

### Don't allow deriving Color from Hsla

The point of the [ui::Color] enum is to encourage consistent color
usage, and the the Color::Custom case is really only meant for cases
where we have no other choice.

`impl From<Hsla> for Color` encourages blindly passing colors into
`Color::Custom` – with this in place we might as well remove the entire
`Color` enum.

The usages that were updated due to this removal were for colors that
already exist in the Color enum, making it even more clear that it
didn't make sense to have this.

### `ElevationIndex` -> `Elevation`

This name would make more sense if we had an `Elevation` in the first
place. The new name is more clear.

#### `Button::elevation`

As part of this change I also updated button's `layer` method to
`elevation`, since it takes an elevation. This method still has the
following issue:

You want to use `Button::elevation` when it's default colors are
invisible on the layer you are rendering the button on. However, current
this method uses the elevation's `bg` color, rather than it's
`on_elevation_bg`.

Ideally when you use `Button::elevation` you want to pass the elevation
you are _on_, not choosing one that will show up the elevation you are
on.

This change will be in a separate PR, as it likely will have widespread
visual impact across the app.

Release Notes:

- N/A
2025-03-13 15:18:40 +00:00
..
components ui: Color cleanup (#26673) 2025-03-13 15:18:40 +00:00
styles ui: Color cleanup (#26673) 2025-03-13 15:18:40 +00:00
tests ui crate docs & spring cleaning (#18768) 2024-10-05 23:28:34 -04:00
traits ui: Color cleanup (#26673) 2025-03-13 15:18:40 +00:00
utils ui: More component previews, UI component cleanup (#25302) 2025-02-21 09:20:53 -05:00
components.rs Add StatusToast & the ToastLayer (#26232) 2025-03-06 20:37:54 +00:00
prelude.rs Add StatusToast & the ToastLayer (#26232) 2025-03-06 20:37:54 +00:00
styles.rs Add StatusToast & the ToastLayer (#26232) 2025-03-06 20:37:54 +00:00
tests.rs ui crate docs & spring cleaning (#18768) 2024-10-05 23:28:34 -04:00
traits.rs component: Add component and component_preview crates to power UI components (#24456) 2025-02-09 13:25:03 -05:00
ui.rs ui: More component previews, UI component cleanup (#25302) 2025-02-21 09:20:53 -05:00
utils.rs Eliminate GPUI View, ViewContext, and WindowContext types (#22632) 2025-01-26 03:02:45 +00:00