-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
261 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
//! Change the appearance of an application. | ||
use iced_core::Color; | ||
|
||
/// A set of rules that dictate the style of an application. | ||
pub trait StyleSheet { | ||
/// The supported style of the [`StyleSheet`]. | ||
type Style: Default; | ||
|
||
/// Returns the [`Appearance`] of the application for the provided [`Style`]. | ||
/// | ||
/// [`Style`]: Self::Style | ||
fn appearance(&self, style: &Self::Style) -> Appearance; | ||
} | ||
|
||
/// The appearance of an application. | ||
#[derive(Debug, Clone, Copy, PartialEq)] | ||
pub struct Appearance { | ||
/// The background [`Color`] of the application. | ||
pub background_color: Color, | ||
|
||
/// The default text [`Color`] of the application. | ||
pub text_color: Color, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
//! Show toggle controls using checkboxes. | ||
//! Change the appearance of a checkbox. | ||
use iced_core::{Background, Color}; | ||
|
||
/// The appearance of a checkbox. | ||
#[derive(Debug, Clone, Copy)] | ||
pub struct Appearance { | ||
/// The [`Background`] of the checkbox. | ||
pub background: Background, | ||
/// The checkmark [`Color`] of the checkbox. | ||
pub checkmark_color: Color, | ||
/// The border radius of the checkbox. | ||
pub border_radius: f32, | ||
/// The border width of the checkbox. | ||
pub border_width: f32, | ||
/// The border [`Color`] of the checkbox. | ||
pub border_color: Color, | ||
/// The text [`Color`] of the checkbox. | ||
pub text_color: Option<Color>, | ||
} | ||
|
||
/// A set of rules that dictate the style of a checkbox. | ||
pub trait StyleSheet { | ||
/// The supported style of the [`StyleSheet`]. | ||
type Style: Default; | ||
|
||
/// Produces the active [`Appearance`] of a checkbox. | ||
fn active(&self, style: &Self::Style, is_checked: bool) -> Appearance; | ||
|
||
/// Produces the hovered [`Appearance`] of a checkbox. | ||
fn hovered(&self, style: &Self::Style, is_checked: bool) -> Appearance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
//! Change the appearance of menus. | ||
use iced_core::{Background, Color}; | ||
|
||
/// The appearance of a menu. | ||
#[derive(Debug, Clone, Copy)] | ||
pub struct Appearance { | ||
/// The text [`Color`] of the menu. | ||
pub text_color: Color, | ||
/// The [`Background`] of the menu. | ||
pub background: Background, | ||
/// The border width of the menu. | ||
pub border_width: f32, | ||
/// The border radius of the menu. | ||
pub border_radius: f32, | ||
/// The border [`Color`] of the menu. | ||
pub border_color: Color, | ||
/// The text [`Color`] of a selected option in the menu. | ||
pub selected_text_color: Color, | ||
/// The background [`Color`] of a selected option in the menu. | ||
pub selected_background: Background, | ||
} | ||
|
||
/// The style sheet of a menu. | ||
pub trait StyleSheet { | ||
/// The supported style of the [`StyleSheet`]. | ||
type Style: Default + Clone; | ||
|
||
/// Produces the [`Appearance`] of a menu. | ||
fn appearance(&self, style: &Self::Style) -> Appearance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,33 @@ | ||
//! Change the appearance of a pick list. | ||
use iced_core::{Background, Color}; | ||
|
||
/// The appearance of a pick list. | ||
#[derive(Debug, Clone, Copy)] | ||
pub struct Appearance { | ||
/// The text [`Color`] of the pick list. | ||
pub text_color: Color, | ||
/// The placeholder [`Color`] of the pick list. | ||
pub placeholder_color: Color, | ||
/// The [`Background`] of the pick list. | ||
pub background: Background, | ||
/// The border radius of the pick list. | ||
pub border_radius: f32, | ||
/// The border width of the pick list. | ||
pub border_width: f32, | ||
/// The border color of the pick list. | ||
pub border_color: Color, | ||
/// The size of the arrow icon of the pick list. | ||
pub icon_size: f32, | ||
} | ||
|
||
/// A set of rules that dictate the style of a container. | ||
pub trait StyleSheet { | ||
/// The supported style of the [`StyleSheet`]. | ||
type Style: Default + Clone; | ||
|
||
/// Produces the active [`Appearance`] of a pick list. | ||
fn active(&self, style: &<Self as StyleSheet>::Style) -> Appearance; | ||
|
||
/// Produces the hovered [`Appearance`] of a pick list. | ||
fn hovered(&self, style: &<Self as StyleSheet>::Style) -> Appearance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
//! Provide progress feedback to your users. | ||
//! Change the appearance of a progress bar. | ||
use iced_core::Background; | ||
|
||
/// The appearance of a progress bar. | ||
#[derive(Debug, Clone, Copy)] | ||
pub struct Appearance { | ||
/// The [`Background`] of the progress bar. | ||
pub background: Background, | ||
/// The [`Background`] of the bar of the progress bar. | ||
pub bar: Background, | ||
/// The border radius of the progress bar. | ||
pub border_radius: f32, | ||
} | ||
|
||
/// A set of rules that dictate the style of a progress bar. | ||
pub trait StyleSheet { | ||
/// The supported style of the [`StyleSheet`]. | ||
type Style: Default; | ||
|
||
/// Produces the [`Appearance`] of the progress bar. | ||
fn appearance(&self, style: &Self::Style) -> Appearance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
//! Create choices using radio buttons. | ||
//! Change the appearance of radio buttons. | ||
use iced_core::{Background, Color}; | ||
|
||
/// The appearance of a radio button. | ||
#[derive(Debug, Clone, Copy)] | ||
pub struct Appearance { | ||
/// The [`Background`] of the radio button. | ||
pub background: Background, | ||
/// The [`Color`] of the dot of the radio button. | ||
pub dot_color: Color, | ||
/// The border width of the radio button. | ||
pub border_width: f32, | ||
/// The border [`Color`] of the radio button. | ||
pub border_color: Color, | ||
/// The text [`Color`] of the radio button. | ||
pub text_color: Option<Color>, | ||
} | ||
|
||
/// A set of rules that dictate the style of a radio button. | ||
pub trait StyleSheet { | ||
/// The supported style of the [`StyleSheet`]. | ||
type Style: Default; | ||
|
||
/// Produces the active [`Appearance`] of a radio button. | ||
fn active(&self, style: &Self::Style, is_selected: bool) -> Appearance; | ||
|
||
/// Produces the hovered [`Appearance`] of a radio button. | ||
fn hovered(&self, style: &Self::Style, is_selected: bool) -> Appearance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.