aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPolesznyák Márk <contact@pml68.dev>2025-12-30 16:05:06 +0100
committerPolesznyák Márk <contact@pml68.dev>2026-02-05 14:36:37 +0100
commit93f6a7f63958ea413cc42a16168e3a71459b805a (patch)
treef742a702289fd1c9d239ddd286b5c62844b55035
parentfix: graphemes with multi codepoint on multiple visual lines (diff)
downloadiced_selection-93f6a7f63958ea413cc42a16168e3a71459b805a.tar.gz
feat(rich example): set theme to always Dark, add more text
-rw-r--r--examples/rich/src/main.rs30
1 files changed, 25 insertions, 5 deletions
diff --git a/examples/rich/src/main.rs b/examples/rich/src/main.rs
index 9ee2ea9..7cb3245 100644
--- a/examples/rich/src/main.rs
+++ b/examples/rich/src/main.rs
@@ -3,7 +3,9 @@ use iced::{Center, Element, Fill, Font, color, font, padding};
use iced_selection::{rich_text, span};
fn main() -> iced::Result {
- iced::run(State::update, State::view)
+ iced::application(State::default, State::update, State::view)
+ .theme(iced::Theme::Dark)
+ .run()
}
#[derive(Default)]
@@ -45,7 +47,7 @@ impl State {
span("Rust")
.color(color!(0x2b79a2))
.link("https://rust-lang.org"),
- ".\nIt is inspired by ",
+ ". It is inspired by ",
span("Elm")
.color(color!(0x2b79a2))
.link("https://elm-lang.org"),
@@ -55,12 +57,30 @@ impl State {
.color(color!(0x2b79a2))
.link("https://en.wikipedia.org/wiki/Graphical_user_interface")
.font(Font {
- style:font::Style::Italic,
+ style: font::Style::Italic,
..Font::DEFAULT
}),
- " for your Rust applications."
+ " for your Rust applications.\n\n",
+ "iced is strongly focused on ",
+ span("simplicity")
+ .font(Font {
+ weight: font::Weight::Bold,
+ ..Font::DEFAULT
+ }),
+ " and ",
+ span("type-safety")
+ .font(Font {
+ weight: font::Weight::Bold,
+ ..Font::DEFAULT
+ }),
+ ". As a result, iced tries to provide simple building blocks that can be put together with strong typing to reduce the chance of ",
+ span("runtime errors")
+ .font(Font {
+ weight: font::Weight::Bold,
+ ..Font::DEFAULT
+ }),
+ "."
]
- .align_x(Center)
.on_link_click(Message::LinkClicked)
.on_link_hover(Message::LinkHovered)
.on_hover_lost(Message::HoverLost),