summaryrefslogtreecommitdiffstats
path: root/style
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-03 18:51:30 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-03 18:51:30 +0100
commit17cb548e20a0594684b00c2eeda0e81cc8d06095 (patch)
tree2d6fea959f42bed1a7ff214d85de4f12785d32aa /style
parent5770efe06dc552409daf586590d4f477206c732b (diff)
downloadiced-17cb548e20a0594684b00c2eeda0e81cc8d06095.tar.gz
iced-17cb548e20a0594684b00c2eeda0e81cc8d06095.tar.bz2
iced-17cb548e20a0594684b00c2eeda0e81cc8d06095.zip
Use `Theme::ALL` for theme selector in `styling` example
Diffstat (limited to 'style')
-rw-r--r--style/src/theme.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs
index b1902b06..890f6dce 100644
--- a/style/src/theme.rs
+++ b/style/src/theme.rs
@@ -25,6 +25,7 @@ use crate::core::{Background, Border, Color, Shadow, Vector};
use std::fmt;
use std::rc::Rc;
+use std::sync::Arc;
/// A built-in theme.
#[derive(Debug, Clone, PartialEq, Default)]
@@ -47,12 +48,21 @@ pub enum Theme {
/// The built-in gruvbox dark variant.
GruvboxDark,
/// A [`Theme`] that uses a [`Custom`] palette.
- Custom(Box<Custom>),
+ Custom(Arc<Custom>),
}
impl Theme {
/// A list with all the defined themes.
- pub const ALL: &'static [Self] = &[Self::Light, Self::Dark];
+ pub const ALL: &'static [Self] = &[
+ Self::Light,
+ Self::Dark,
+ Self::Dracula,
+ Self::Nord,
+ Self::SolarizedLight,
+ Self::SolarizedDark,
+ Self::GruvboxLight,
+ Self::GruvboxDark,
+ ];
/// Creates a new custom [`Theme`] from the given [`Palette`].
pub fn custom(name: String, palette: Palette) -> Self {
@@ -66,7 +76,7 @@ impl Theme {
palette: Palette,
generate: impl FnOnce(Palette) -> palette::Extended,
) -> Self {
- Self::Custom(Box::new(Custom::with_fn(name, palette, generate)))
+ Self::Custom(Arc::new(Custom::with_fn(name, palette, generate)))
}
/// Returns the [`Palette`] of the [`Theme`].