# luhcore
`luhcore` is a small utility crate providing core functionality commonly needed in my applications, including:
- **Terminal styling** via [`Colorise`], [`Style`], [`StyledText`], and [`Color`].
- **Platform directories** handling via [`dirs::AppDirs`].
- **Build and environment checks** like `is_ci()`, `is_debug_build()`, and `is_release_build()`.
## Modules
- [`color`]: Extension trait for coloring strings and styled text.
- [`style`]: Core style types (`Style`, `StyledText`, `Color`) and styling logic.
- [`dirs`]: Application directories handling (`AppDirs`) for config, cache, temp files, etc.
## Features
- **Terminal text styling**
Apply foreground/background colors, bold, underline, and dim effects using a convenient trait interface.
- **Environment detection**
Check if running in a CI environment, or whether the build is a debug or release build.
- **Cross-platform directories**
Create and manage app-specific config, cache, and temporary directories, including development temp files.
## Examples
### Terminal styling
```rust
use luhcore::Colorise;
println!("{}", "error".red().bold());
println!("{}", "warning".yellow().underline());
println!("{}", "success".green().on_white().dim());
```
### Environment detection
```rust
use luhcore::{is_ci, is_debug_build};
if is_ci() {
println!("Running in CI environment");
}
if is_debug_build() {
println!("Running in debug mode");
}
```
### Directories handling
```rust
use luhcore::dirs::AppDirs;
fn main() -> std::io::Result<()> {
let dirs = AppDirs::for_app("luhcore")?;
dirs.ensure_all()?;
println!("Config dir: {}", dirs.config.display());
println!("Cache dir: {}", dirs.cache.display());
println!("Temp dir: {}", dirs.temp.display());
let temp_file = dirs.dev_temp_file("example.txt");
println!("Development temp file path: {}", temp_file.display());
Ok(())
}
```
## Note
> made with love s.c 2025 :)