Basic Styling Properties
Background Colors
Set solid background colors using thebackground() method with RGB or RGBA tuples:
Borders
Add borders to elements with customizable width, color, and alignment:Corner Radius
Create rounded corners usingcorner_radius():
Padding and Margin
Control spacing inside (padding) and outside (margin) elements:Gradients
Freya supports three types of gradients: linear, radial, and conic.Linear Gradients
Create smooth color transitions in a linear direction:Radial Gradients
Create gradients that radiate from a center point:Conic Gradients
Create gradients that rotate around a center point:Shadows
Add depth to your UI with box shadows:Multiple Shadows
You can apply multiple shadows to a single element:Inset Shadows
Create inner shadows for depth effects:Blur Effects
Apply blur effects to create glassmorphism or focus effects:Text Styling
Style text content with font properties:Opacity
Control element transparency:Best Practices
1. Use Theme Colors
When possible, use theme-aware colors for consistency:2. Consistent Spacing
Maintain consistent spacing throughout your app:3. Performance Considerations
- Heavy blur effects can impact performance on lower-end devices
- Multiple shadows increase rendering complexity
- Use solid colors instead of gradients when possible for better performance
4. Accessibility
Ensure sufficient color contrast for text readability:Common Patterns
Card Style
Button Style
Glassmorphism
Next Steps
- Learn about Theming for consistent styling across your app
- Explore Layouts to position and size your styled elements
- Check the Components API for pre-styled components