You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.0 KiB
64 lines
1.0 KiB
use super::*;
|
|
|
|
use std::{
|
|
fmt::Display,
|
|
};
|
|
#[cfg(feature="colour")]
|
|
#[macro_export] macro_rules! colour {
|
|
($things:path) => {
|
|
{
|
|
#[allow(unused_imports)]
|
|
use recolored::{
|
|
Color,
|
|
};
|
|
|
|
$things
|
|
}
|
|
}
|
|
}
|
|
#[cfg(not(feature="colour"))]
|
|
#[macro_export] macro_rules! colour {
|
|
($things:path) => {
|
|
()
|
|
}
|
|
}
|
|
|
|
#[cfg(not(feature="colour"))]
|
|
/// Dummy enum
|
|
pub enum Color {
|
|
Black,
|
|
Red,
|
|
Green,
|
|
Yellow,
|
|
Blue,
|
|
Magenta,
|
|
Cyan,
|
|
White,
|
|
BrightBlack,
|
|
BrightRed,
|
|
BrightGreen,
|
|
BrightYellow,
|
|
BrightBlue,
|
|
BrightMagenta,
|
|
BrightCyan,
|
|
BrightWhite,
|
|
Palette(u8),
|
|
True(u8, u8, u8),
|
|
}
|
|
|
|
#[cfg(feature="colour")] pub type Colour = recolored::Color;
|
|
#[cfg(not(feature="colour"))] pub type Colour = ();
|
|
|
|
#[inline] pub fn style(_col: Colour, from: impl Display) -> impl Display
|
|
{
|
|
cfg_if! {
|
|
if #[cfg(feature="colour")] {
|
|
use recolored::Colorize;
|
|
let string = format!("{}", from);
|
|
string.color(_col)
|
|
} else {
|
|
from
|
|
}
|
|
}
|
|
}
|