leptos_color

Crates.ioleptos_color
lib.rsleptos_color
version
sourcesrc
created_at2024-10-17 14:40:56.675523
updated_at2024-10-17 14:40:56.675523
descriptionLeptos Color is a simple Crate that gives access to a color picker for leptos
homepage
repositoryhttps://github.com/TimTom2016/leptos_color
max_upload_size
id1413319
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
(TimTom2016)

documentation

https://docs.rs/leptos_color/latest/

README

Leptos Color

Crates.io docs.rs

Leptos Color is a simple crate that provides a color picker component for Leptos, a Rust web framework. It allows easy integration of color selection functionality in Leptos applications.

Features

  • Color Picker: A customizable color picker component.
  • Color Input: An input field with an attached color picker.
  • Theme Support: Customizable theming options.
  • Flexible Configuration: Options to hide specific color input types (alpha, hex, RGB).

Installation

Add the following to your Cargo.toml:

[dependencies]
leptos_color = "0.6.14"

Usage

Basic Color Picker

use leptos::*;
use leptos_color::{components::color_picker::ColorPicker, Color};

#[component]
fn App() -> impl IntoView {
    let (color, set_color) = create_signal(Color::new(1.0, 1.0, 1.0, 1.0));

    view! {
        <ColorPicker
            color=color
            on_change=move |new_color| set_color.set(new_color)
        />
    }
}

Color Input

use leptos::*;
use leptos_color::{components::color_input::ColorInput, Color};

#[component]
fn App() -> impl IntoView {
    let color = create_rw_signal(Color::new(1.0, 1.0, 1.0, 1.0));

    view! {
        <ColorInput
            color=color
            on_change=move |new_color| color.set(new_color)
        />
    }
}

Configuration Options

  • theme: Customize the appearance of the color picker.
  • hide_alpha: Hide the alpha (opacity) input.
  • hide_hex: Hide the hexadecimal color input.
  • hide_rgb: Hide the RGB color inputs.

Examples

Check the examples/basic-ssr directory for a complete example of how to use Leptos Color in a server-side rendered application.

Feature Flags

  • default: Includes the color_input feature.
  • csr: Client-side rendering support.
  • ssr: Server-side rendering support.
  • hydrate: Hydration support.
  • color_input: Enables the ColorInput component.

Documentation

For more detailed information, check out the API documentation.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 7

cargo fmt