icedtea 0.2.0

Native desktop widgets and chrome for iced
Documentation

icedtea

Documentation Crates.io License check

Native desktop widgets and chrome for iced.

icedtea::run! starts a themed window. Constructors return iced Elements and emit your messages. Color, layout, and chrome are Rust values.

The icedtea gallery

The gallery is a running catalog: every catalog::ENTRIES id appears on a page. Each id has one constructor; rustdoc on that function is the intended call. Related controls share a page. Run it from a checkout:

cargo run -p icedtea-gallery

First window

[dependencies]
iced = "0.14"
icedtea = "0.2"
use icedtea::a11y::A11y;
use icedtea::theme;
use icedtea::variant::Variant;
use icedtea::widget;
use icedtea::{Boot, Element, Task};

fn main() -> icedtea::iced::Result {
    icedtea::run!(
        Boot::new("Hello", "dev.example.hello"),
        Hello::new,
        Hello::update,
        Hello::view,
        Hello::theme
    )
}

struct Hello {
    n: i32,
}

#[derive(Clone)]
enum Message {
    Inc,
}

impl Hello {
    fn new() -> (Self, Task<Message>) {
        (Self { n: 0 }, Task::none())
    }

    fn update(&mut self, message: Message) -> Task<Message> {
        if matches!(message, Message::Inc) {
            self.n += 1;
        }
        Task::none()
    }

    fn view(&self) -> Element<'_, Message> {
        let tok = theme::named("dark").tokens;
        widget::themed_button(
            format!("Count {}", self.n),
            Some(Message::Inc),
            tok,
            Variant::Primary,
            A11y::button("inc"),
        )
    }

    fn theme(&self) -> icedtea::iced::Theme {
        theme::iced_theme("dark", theme::named("dark").tokens)
    }
}

Same program: cargo run --example hello in this repository.

Tokens mix in ordinary Rust:

let tokens = icedtea::theme::named("dark").tokens;
let mixed = icedtea::theme::mix(tokens.primary, tokens.canvas, 0.28);
assert_eq!(mixed, tokens.selection);

Where to look

  • Guide — first window, actions, layout, theming, overlays
  • API docs — widget, theme, action, layout, window, pattern
  • Gallery — every public control and pattern
  • Release notes

One Action feeds menus, toolbars, shortcuts, and the command palette. theme::named has forty colorways. Linux needs libxkbcommon-dev and libwayland-dev. macOS needs the Xcode command-line tools. Windows needs the MSVC build tools.

iced icedtea
0.14 0.2