Added readme, badges, ci
This commit is contained in:
parent
8f8bd96dae
commit
78fdd4c297
|
@ -0,0 +1,14 @@
|
|||
name: Publish Documentation
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build
|
||||
run: cargo test
|
|
@ -3,12 +3,7 @@ title: Arkham
|
|||
subtitle: An Ergonomic TUI Framework
|
||||
---
|
||||
|
||||
|
||||
```Rust
|
||||
fn welcome(ctx &mut ViewContext) {
|
||||
ctx.insert((0,0), "Welcome");
|
||||
}
|
||||
```
|
||||
![welcome](/welcome.png)
|
||||
|
||||
# Robust TUI foundation
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 117 KiB |
|
@ -0,0 +1,85 @@
|
|||
<div align="center">
|
||||
<h1>Arkham</h1>
|
||||
<p>
|
||||
<strong>An ergonomic TUI Framework</strong>
|
||||
</p>
|
||||
<!-- prettier-ignore-start -->
|
||||
[![crates.io](https://img.shields.io/crates/v/arkham?label=latest)](https://crates.io/crates/arkham)
|
||||
[![Documentation](https://docs.rs/arkham/badge.svg?version=0.2.1)](https://docs.rs/arkham/0.2.1)
|
||||
![Crates.io Downloads (latest version)](https://img.shields.io/crates/dv/arkham)
|
||||
[![guide](https://github.com/actix/actix/actions/workflows/docs.yml/badge.svg)](https://github.com/5sigma/arkham/actions/workflows/docs.yml)
|
||||
[![CI](https://github.com/actix/actix/actions/workflows/ci.yml/badge.svg)](https://github.com/5sigma/arkham/actions/workflows/ci.yml)
|
||||
<!-- prettier-ignore-end -->
|
||||
[Read The Guide](https://5sigma.github.io/arkham)
|
||||
<p>
|
||||
</div>
|
||||
|
||||
|
||||
# Robust TUI foundation
|
||||
|
||||
Arkham attempts to give a firm foundation for building TUI Apps.
|
||||
It does not provide a set of widgets or components that can be used.
|
||||
Instead, it tries to make the process of building terminal interfaces
|
||||
easy enough that they aren't necessary.
|
||||
|
||||
- Keyboard handling
|
||||
- Terminal modification
|
||||
- Full screen terminal UIs with _alternate screen_ handling
|
||||
- Full run loop and rendering engine
|
||||
- Easy text formatting and styling
|
||||
- Ergonomic component architecture
|
||||
- Dependency injection
|
||||
|
||||
# Components are simple functions
|
||||
|
||||
```Rust
|
||||
fn my_component(ctx &mut ViewContext) {
|
||||
ctx.insert((0,0), "Welcome");
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# Easily handle text styling
|
||||
|
||||
```Rust
|
||||
fn my_component(ctx &mut ViewContext) {
|
||||
ctx.insert(
|
||||
(0,0),
|
||||
"Welcome"
|
||||
.to_runes()
|
||||
.bg(Color::Blue)
|
||||
.fg(Color::White),
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# Painless dependency injection
|
||||
|
||||
```Rust
|
||||
fn my_component(ctx &mut ViewContext, user: Res<MyUser>) {
|
||||
ctx.insert(
|
||||
(0,0),
|
||||
format!("Hello, {}", user.name),
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
# Easy keyboard handling
|
||||
|
||||
```Rust
|
||||
fn my_component(ctx &mut ViewContext, kb: Res<Keyboard>) {
|
||||
if kb.char() == Some('x') {
|
||||
ctx.insert(
|
||||
(0,0),
|
||||
"X marks the spot"
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
10
src/view.rs
10
src/view.rs
|
@ -70,16 +70,6 @@ impl View {
|
|||
(self.width(), self.height()).into()
|
||||
}
|
||||
|
||||
/// Paint is a conveinence method for filling a region ith a given color.
|
||||
/// This is done by using the passed color as the background color and
|
||||
/// filling the region with ' ' characters.
|
||||
pub fn paint<R>(&mut self, rect: R, color: Color)
|
||||
where
|
||||
R: Into<Rect>,
|
||||
{
|
||||
self.fill(rect, Rune::new().content(' ').bg(color));
|
||||
}
|
||||
|
||||
/// Fill a region of the view with a single rune, repeating it in every
|
||||
/// position.
|
||||
pub fn fill<R, U>(&mut self, rect: R, rune: U)
|
||||
|
|
Loading…
Reference in New Issue