diff options
| author | Polesznyák Márk <contact@pml68.dev> | 2025-12-30 16:05:06 +0100 |
|---|---|---|
| committer | Polesznyák Márk <contact@pml68.dev> | 2025-12-30 16:05:06 +0100 |
| commit | 9c38b12cbd0c0232c26ffc891b78a84ceef4dad8 (patch) | |
| tree | 578c85f9a66f6557fce0b3705a7dcd4c9f9743ad /examples/rich | |
| parent | fix: graphemes with multi codepoint on multiple visual lines (diff) | |
| download | iced_selection-9c38b12cbd0c0232c26ffc891b78a84ceef4dad8.tar.gz | |
feat(rich example): set theme to always Dark, add more text
Diffstat (limited to '')
| -rw-r--r-- | examples/rich/src/main.rs | 30 |
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), |
