Skip to content

Commit

Permalink
fix(cosmic): support icon color renderer style
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Sep 1, 2023
1 parent 4013946 commit 8bcf313
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ iced = ["dep:iced", "dep:iced_runtime", "dep:iced_widget", "dep:iced_futures", "
once_cell = ["dep:once_cell"]
wayland-libcosmic = ["libcosmic", "libcosmic/wayland"]
winit-libcosmic = ["libcosmic", "libcosmic/winit"]
libcosmic = ["dep:libcosmic"]
libcosmic = ["dep:libcosmic", "libcosmic/tokio"]

[workspace]
members = [
Expand All @@ -30,7 +30,8 @@ iced_widget = { version = "0.1.3", optional = true }
iced_futures = { version = "0.7.0", optional = true }
iced_core = { version = "0.10.0", optional = true }
iced_style = { version = "0.9.0", optional = true }
libcosmic = { git = "https://github.com/pop-os/libcosmic/", default-features = false, features = [ "tokio" ], optional = true }
# libcosmic = { path = "../libcosmic", optional = true }
# libcosmic = { git = "https://github.com/pop-os/libcosmic/", default-features = false, features = [ "tokio" ], optional = true }
libcosmic = { path = "../libcosmic", optional = true }
once_cell = { version = "1.18.0", optional = true }
float-cmp = "0.9"

5 changes: 4 additions & 1 deletion src/widget/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ where
tree: &Tree,
renderer: &mut Renderer,
theme: &Renderer::Theme,
_style: &renderer::Style,
#[cfg(feature = "libcosmic")] style: &renderer::Style,
#[cfg(not(feature = "libcosmic"))] _style: &renderer::Style,
layout: Layout<'_>,
cursor_position: mouse::Cursor,
_viewport: &Rectangle,
Expand All @@ -216,6 +217,8 @@ where
renderer,
theme,
&renderer::Style {
#[cfg(feature = "libcosmic")]
icon_color: styling.icon_color.unwrap_or(style.icon_color),
text_color: styling.text_color,
},
content_layout,
Expand Down
4 changes: 3 additions & 1 deletion src/widget/cosmic_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use cosmic::iced_core::{
};
use cosmic::iced_renderer::core::widget::{operation, OperationOutputWrapper};

pub use cosmic::iced_style::button::{Appearance, StyleSheet};
pub use cosmic::widget::button::{Appearance, StyleSheet};

/// A generic widget that produces a message when pressed.
#[allow(missing_debug_implementations)]
Expand Down Expand Up @@ -271,6 +271,8 @@ where
renderer,
theme,
&renderer::Style {
#[cfg(feature = "libcosmic")]
icon_color: styling.icon_color.unwrap_or(style.icon_color),
text_color: styling.text_color,
scale_factor: style.scale_factor,
},
Expand Down

0 comments on commit 8bcf313

Please sign in to comment.