fix(theme): draw selected label text in the on-accent color
This commit is contained in:
parent
56a210bb4e
commit
53314201b0
3 changed files with 13 additions and 6 deletions
2
iced
2
iced
|
|
@ -1 +1 @@
|
|||
Subproject commit 2e12eba5cd9ddf9995e113fbc9fa0ebf8f0f0f97
|
||||
Subproject commit 9ef36c9604c8eb1d34a4e4f9df438a1da0f9e8a2
|
||||
|
|
@ -1371,18 +1371,22 @@ impl iced_widget::text::Catalog for Theme {
|
|||
|
||||
fn style(&self, class: &Self::Class<'_>) -> iced_widget::text::Style {
|
||||
let selected_fill = self.cosmic().accent.base.into();
|
||||
let selected_text_color = Some(self.cosmic().on_accent_color().into());
|
||||
match class {
|
||||
Text::Accent => iced_widget::text::Style {
|
||||
color: Some(self.cosmic().accent_text_color().into()),
|
||||
selected_fill,
|
||||
selected_text_color,
|
||||
},
|
||||
Text::Default => iced_widget::text::Style {
|
||||
color: None,
|
||||
selected_fill,
|
||||
selected_text_color,
|
||||
},
|
||||
Text::Color(c) => iced_widget::text::Style {
|
||||
color: Some(*c),
|
||||
selected_fill,
|
||||
selected_text_color,
|
||||
},
|
||||
Text::Custom(f) => f(self),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2903,14 +2903,17 @@ pub fn draw<'a, Message>(
|
|||
effective_alignment(state.value.raw()),
|
||||
);
|
||||
|
||||
if cursors.is_empty() {
|
||||
renderer.with_translation(Vector::ZERO, |_| {});
|
||||
} else {
|
||||
renderer.with_translation(Vector::new(alignment_offset - offset, 0.0), |renderer| {
|
||||
let shift = Vector::new(alignment_offset - offset, 0.0);
|
||||
let fill_cursors = |renderer: &mut crate::Renderer| {
|
||||
renderer.with_translation(shift, |renderer| {
|
||||
for (quad, color) in &cursors {
|
||||
renderer.fill_quad(*quad, *color);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if !is_selecting {
|
||||
fill_cursors(renderer);
|
||||
}
|
||||
|
||||
let bounds = Rectangle {
|
||||
|
|
@ -2946,7 +2949,7 @@ pub fn draw<'a, Message>(
|
|||
// Redraw the same text in the selected color, clipped to the selection quads,
|
||||
// so glyph shaping and positioning stay identical to the unselected pass.
|
||||
if is_selecting {
|
||||
let shift = Vector::new(alignment_offset - offset, 0.0);
|
||||
fill_cursors(renderer);
|
||||
for (quad, _) in &cursors {
|
||||
renderer.with_layer(quad.bounds + shift, |renderer| {
|
||||
renderer.fill_text(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue