A CSS library for Rust, focusing on ergnomic abstractions.

Overview

CSSugar

A CSS values and units library for Rust, focusing on ergnomic abstractions.

Goal

The goal is to wrap all CSS values and units in an ergonomic, rusty way. This is primarily for ecosystem tooling built around Yew and Stylist.

Read more:

Examples

Numbers, lengths, and percentages

Read more

use cssugar::units::{Px, Vw};

#[function_component(SizedButton)]
pub fn sized_button() -> Html {
    let size = Vw(100) - Px(300);
    let button_css = format!("width: ${size};");
    html! {
        <button style={button_css}>{ "CLICK ME!" }</button>
    }
}

Expected Output:

<button style="width: calc(100vw - 300px);">CLICK ME!</button>

Colors

Read more

use cssugar::colors::{Color, BLACK};

#[function_component(SizedButton)]
pub fn sized_button() -> Html {
    let color = Color::rgb(255, 0, 0).blend(BLACK);
    let label_css = format!("color: ${color};");
    html! {
        <label style={label_css}>{ "I am dark red!" }</label>
    }
}

Expected Output:

<label style="color: rgba(128, 0, 0, 1.0);">I am dark red!</label>

Images

Read more TODO

Strings and Identifiers

Read more TODO

Functions

Read more

use cssugar::colors::{Color, BLACK};

#[function_component(SizedButton)]
pub fn sized_button() -> Html {
    let color = Color::rgb(255, 0, 0).blend(BLACK);
    let label_css = format!("color: ${color};");
    html! {
        <label style={label_css}>{ "I am dark red!" }</label>
    }
}

Expected Output:

<label style="color: rgba(128, 0, 0, 1.0);">I am dark red!</label>

You might also like...
Highly experimental, pure-Rust big integer library

grou-num (Pronounced "groo", from the Chiac meaning "big") This package is a highly experimental, unstable big integer library. I would not recommend

"Crates for Cheese" is a Rust collection library of those crates I consider a useful "extended standard".

cfc The purpose of this library is to provide a minimal list of currated crates which enhance the std library. In addition, most or all crates in this

An advanced, reactive UI library for Rust

An advanced, reactive UI library for Rust Report a Bug · Request a Feature . Ask a Question What is agui? Agui is an advanced reactive GUI project for

Functional Reactive Programming library for Rust

Carboxyl is a library for functional reactive programming in Rust, a functional and composable approach to handle events in interactive applications.

A library for transcoding between bytes in Astro Notation Format and Native Rust data types.

Rust Astro Notation A library for transcoding between hexadecimal strings in Astro Notation Format and Native Rust data types. Usage In your Cargo.tom

A rust library that provides pseudo-reflection for structs and enums

Treeflection treeflection_derive Treeflection runs a command stored as a string on a tree of structs, collections and primitive types. Commands A comm

List public items (public API) of Rust library crates. Enables diffing public API between releases.

cargo wrapper for this library You probably want the cargo wrapper to this library. See https://github.com/Enselic/cargo-public-items. public_items Li

A simple thread schedule and priority library for rust

thread-priority A simple library to control thread schedule policies and thread priority. If your operating system isn't yet supported, please, create

Library for abstract mathematics written by Rust. It is aiming to replace SageMath.

ankolib Roadmap Mathematical Structures Sets Monoids Groups Semirings Rings Algebras Basic Rings and Fields Integers and Rational Numbers Integer Rati

Owner
Spencer C. Imbleau (he/him)
Rustacean 🦀 and Software Engineer @ NASA 🚀 M.Sc., Computer Science 🎓 Maintainer of Trunk
Spencer C. Imbleau (he/him)
Low-level CPU and register abstractions for the N64 console

Description This crate is a low-level abstraction (aka a Peripheral Access Crate) over the CPU and memory-mapped registers available on the Nintendo 6

Luke Stadem 5 Dec 17, 2022
Rust 核心库和标准库的源码级中文翻译,可作为 IDE 工具的智能提示 (Rust core library and standard library translation. can be used as IntelliSense for IDE tools)

Rust 标准库中文版 这是翻译 Rust 库 的地方, 相关源代码来自于 https://github.com/rust-lang/rust。 如果您不会说英语,那么拥有使用中文的文档至关重要,即使您会说英语,使用母语也仍然能让您感到愉快。Rust 标准库是高质量的,不管是新手还是老手,都可以从中

wtklbm 493 Jan 4, 2023
A library for extracting #[no_mangle] pub extern "C" functions (https://docs.rust-embedded.org/book/interoperability/rust-with-c.html#no_mangle)

A library for extracting #[no_mangle] pub extern "C" functions In order to expose a function with C binary interface for interoperability with other p

Dmitrii - Demenev 0 Feb 17, 2022
Rust Imaging Library: A high-level Rust imaging crate.

ril Rust Imaging Library: A performant and high-level Rust imaging crate. Documentation • Crates.io • Discord What's this? This is a Rust crate design

Jay3332 18 Jan 5, 2023
Modern Rust utility library delivering modularity, performance & extras; or simply Rust version of Lodash

Lorust - API Documentation Lorust is the Rust version of Lodash, which is a modern Javascript utilty library delivering modularity, performance & extr

Imamuzzaki Abu Salam 2 Jul 9, 2023
Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.

Speedy2D Hardware-accelerated drawing of shapes, images, and text, with an easy to use API. Speedy2D aims to be: The simplest Rust API for creating a

null 223 Dec 26, 2022
Shuttle is a library for testing concurrent Rust code

Shuttle Shuttle is a library for testing concurrent Rust code. It is an implementation of a number of randomized concurrency testing techniques, inclu

Amazon Web Services - Labs 373 Dec 27, 2022
🦀 In progress Rust library for dogehouse.tv 🦀

dogehouse-rs WARNING: Still work in progress do not use yet Example In Cargo.toml dogehouse-rs = "*" In src/main.rs use dogehouse_rs::prelude::*; use

Will 21 Dec 16, 2021
Comprehensive DSP graph and synthesis library for developing a modular synthesizer in Rust, such as HexoSynth.

HexoDSP - Comprehensive DSP graph and synthesis library for developing a modular synthesizer in Rust, such as HexoSynth. This project contains the com

Weird Constructor 45 Dec 17, 2022
Fluent assertion library for Rust with readable messages.

Assertor Assertor makes test assertions and failure messages more human-readable. Assertor is heavily affected by Java Truth in terms of API design an

Google 20 Dec 12, 2022