Expand description
§CSS Value Types
This module provides strongly-typed representations of CSS values used throughout
the Mew CSS library. Each CSS value type is represented as an enum or struct that
implements the Display trait for conversion to CSS string representation.
§Design Philosophy
The value types in this module are designed to:
- Provide type safety by restricting values to valid CSS options
- Enable IDE autocompletion for available values
- Handle the correct string formatting for CSS output
- Support CSS variables through the
Varvariant in each enum
§Common Value Types
Color: CSS color values (named colors, RGB, RGBA, HSL, HSLA, hex)Size: CSS size values (px, %, em, rem, vw, vh, auto)Display: CSS display property valuesPosition: CSS position property valuesFontWeight: CSS font-weight property valuesBorderStyle: CSS border-style property values
§Usage Example
use mew_css::style;
use mew_css::values::{Color, Size, Display};
let css = style()
.color(Color::Blue) // Named color
.background_color(Color::Rgba(240, 240, 240, 0.5)) // RGBA color
.width(Size::Percent(100.0)) // Percentage
.height(Size::Px(200)) // Pixels
.margin(Size::Auto) // Auto value
.display(Display::Flex) // Display type
.apply();Structs§
- BoxShadow
- Box shadow values
- Transition
- Transition values
Enums§
- Align
Items - Align items values
- Border
Style - Border style values
- Color
- Represents CSS color values with various formats and named colors.
- Cursor
- Cursor values
- Display
- Represents CSS display property values that control how elements are rendered.
- Flex
Direction - Flex direction values
- Font
Size - Font size values
- Font
Weight - Font weight values
- Justify
Content - Justify content values
- Line
Height - Line height values
- Overflow
- Overflow values
- Position
- Represents CSS position property values that control element positioning.
- Size
- Represents size and length values for CSS properties.
- Text
Align - Text align values
- Text
Decoration - Text decoration values
- Visibility
- Visibility values
- ZIndex
- Z-index values