added readme
This commit is contained in:
parent
586249d95f
commit
fc746a613d
14
readme.md
Normal file
14
readme.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# mirc-rs
|
||||||
|
|
||||||
|
A simple mirc color code formatter partially inspired by [yansi](https://github.com/SergioBenitez/yansi)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use mirc::Color;
|
||||||
|
|
||||||
|
irc.send_privmsg("#channel", Color::red("red text"));
|
||||||
|
irc.send_privmsg("#channel", format!("Hello: {}", Color::blue("nick")));
|
||||||
|
```
|
||||||
|
|
||||||
|
Works on any type that impl's fmt::Display
|
@ -17,6 +17,7 @@ pub enum ColorCode {
|
|||||||
Pink,
|
Pink,
|
||||||
Grey,
|
Grey,
|
||||||
LightGrey,
|
LightGrey,
|
||||||
|
Raw(i32),
|
||||||
Unset,
|
Unset,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ impl fmt::Display for ColorCode {
|
|||||||
ColorCode::Pink => write!(f, "13"),
|
ColorCode::Pink => write!(f, "13"),
|
||||||
ColorCode::Grey => write!(f, "14"),
|
ColorCode::Grey => write!(f, "14"),
|
||||||
ColorCode::LightGrey => write!(f, "15"),
|
ColorCode::LightGrey => write!(f, "15"),
|
||||||
|
ColorCode::Raw(c) => write!(f, "{:02}", c),
|
||||||
ColorCode::Unset => Ok(()),
|
ColorCode::Unset => Ok(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user