Expand description
Theme system for fastapi_rust console output.
Defines color palettes, icons, spacing, and box styles for consistent visual output across all components. Colors follow the FastAPI visual identity and Swagger UI conventions for familiarity.
§Theme Presets
FastApi- Default theme inspired by FastAPI documentationNeon- High-contrast cyberpunk themeMinimal- Grayscale with subtle accentsMonokai- Dark theme inspired by the Monokai color schemeLight- Optimized for light terminal backgroundsAccessible- High-contrast, WCAG-compliant colors
§Components
FastApiTheme- Color palette for all UI elementsThemeIcons- Unicode icons with ASCII fallbacksThemeSpacing- Consistent layout spacing valuesBoxStyle- Box drawing character sets
§Example
use fastapi_output::themes::{FastApiTheme, ThemePreset, ThemeIcons, ThemeSpacing};
// Get default theme
let theme = FastApiTheme::default();
// Get theme by preset
let neon = FastApiTheme::from_preset(ThemePreset::Neon);
// Use icons (with ASCII fallback)
let icons = ThemeIcons::unicode();
println!("{} Success!", icons.success);
// Consistent spacing
let spacing = ThemeSpacing::default();
let indent = " ".repeat(spacing.indent);
// Parse from environment variable
let preset: ThemePreset = "monokai".parse().unwrap();Structs§
- BoxStyle
- Box drawing character sets for panels and tables.
- BoxStyle
Parse Error - Error parsing box style name.
- Color
- A color in RGB format.
- Fast
ApiTheme - FastAPI-inspired color theme for console output.
- Theme
Icons - Icons used throughout the theme for visual feedback.
- Theme
Preset Parse Error - Error parsing theme preset name.
- Theme
Spacing - Spacing values for consistent layout across components.
Enums§
- BoxStyle
Preset - Preset for box style selection.
- Theme
Preset - Predefined theme presets.
Functions§
- hex_
to_ rgb - Parse hex color to RGB tuple.
- rgb_
to_ hex - Convert RGB tuple to hex string.