mottes-floem-components 0.1.0

Some styled components for floem.
Documentation
//! # Floem components
//!
//! `floem-components` is a component crate for [floem](https://lap.dev/floem/).
//! It is split into multiple modules:
//! 1. `theme` for color theming
//! 2. `views` for standard floem views
//! 3. `classes` for floem classes
//!
//! ## Quickstart
//!
//! ```no_run
//! use floem::{
//!     peniko::Color,
//!     reactive::create_signal,
//!     views::{button, label, Decorators},
//!     IntoView,
//! };
//! use mottes_floem_components::classes::{construct_theme, Button, Label};
//! use mottes_floem_components::theme::Theme;
//!
//! fn app_view() -> impl IntoView {
//!     let (counter, mut set_counter) = create_signal(0);
//!
//!     (
//!         label(move || format!("Value: {counter}")).class(Label),
//!         (
//!             button("Increment")
//!                 .action(move || set_counter += 1)
//!                 .class(Button),
//!             button("Decrement")
//!                 .action(move || set_counter -= 1)
//!                 .class(Button),
//!         ),
//!     )
//!         .style(|_| {
//!             construct_theme(Theme::dark())
//!                 .flex_col()
//!                 .width_full()
//!                 .height_full()
//!                 .background(Color::parse(Theme::dark().base00).unwrap())
//!         })
//! }
//!
//! fn main() {
//!     floem::launch(app_view);
//! }
//! ```
//!
//! If you want to see all components in action, look at the [gallery
//! example](https://codeberg.org/motte/floem-components/src/branch/main/examples/gallery.rs).

use floem::peniko::Color;

pub mod classes;
pub mod theme;
pub mod views;

const BORDER_RADIUS: f32 = 7.5;

fn parse_color(color: &str) -> Color {
    #[allow(clippy::expect_fun_call)]
    Color::parse(color).expect(format!("failed to parse {color}").as_str())
}