mirror of
https://github.com/ratatui/ratatui.git
synced 2025-09-30 22:41:44 +00:00
docs(examples): move colors-rgb example to examples folder (#1582)
- **docs: move colors-rgb example to examples folder** - **docs: update main examples README** --------- Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
This commit is contained in:
parent
0b24e6c7bf
commit
867c4bc4e9
9
Cargo.lock
generated
9
Cargo.lock
generated
@ -559,6 +559,15 @@ version = "1.0.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colors-rgb"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"color-eyre",
|
||||||
|
"palette",
|
||||||
|
"ratatui",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "compact_str"
|
name = "compact_str"
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
|
@ -49,18 +49,30 @@ This is the demo example from the main README and crate page. [Source](./apps/de
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Mouse Drawing demo
|
|
||||||
|
|
||||||
Shows how to handle mouse events. [Source](./apps/mouse-drawing/).
|
|
||||||
|
|
||||||
## Async GitHub demo
|
## Async GitHub demo
|
||||||
|
|
||||||
Shows how to fetch data from GitHub API asynchronously. [Source](./apps/async-github/).
|
Shows how to fetch data from GitHub API asynchronously. [Source](./apps/async-github/).
|
||||||
|
|
||||||
## Weather demo
|
|
||||||
|
|
||||||
Shows how to render weather data using barchart widget. [Source](./apps/weather/).
|
|
||||||
|
|
||||||
## Calendar explorer demo
|
## Calendar explorer demo
|
||||||
|
|
||||||
Shows how to render a calendar with different styles. [Source](./apps/calendar-explorer/).
|
Shows how to render a calendar with different styles. [Source](./apps/calendar-explorer/).
|
||||||
|
|
||||||
|
## Canvas demo
|
||||||
|
|
||||||
|
Shows how to render a canvas with different shapes. [Source](./apps/canvas/).
|
||||||
|
|
||||||
|
## Colors-RGB demo
|
||||||
|
|
||||||
|
This example shows the full range of RGB colors in an animation. [Source](./apps/colors-rgb/).
|
||||||
|
|
||||||
|
## Input form
|
||||||
|
|
||||||
|
Shows how to render a form with input fields. [Source](./apps/input-form/).
|
||||||
|
|
||||||
|
## Mouse Drawing demo
|
||||||
|
|
||||||
|
Shows how to handle mouse events. [Source](./apps/mouse-drawing/).
|
||||||
|
|
||||||
|
## Weather demo
|
||||||
|
|
||||||
|
Shows how to render weather data using barchart widget. [Source](./apps/weather/).
|
||||||
|
15
examples/apps/colors-rgb/Cargo.toml
Normal file
15
examples/apps/colors-rgb/Cargo.toml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[package]
|
||||||
|
name = "colors-rgb"
|
||||||
|
version = "0.1.0"
|
||||||
|
publish = false
|
||||||
|
license.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
color-eyre.workspace = true
|
||||||
|
palette = "0.7.6"
|
||||||
|
ratatui.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
9
examples/apps/colors-rgb/README.md
Normal file
9
examples/apps/colors-rgb/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Colors-RGB demo
|
||||||
|
|
||||||
|
This example shows the full range of RGB colors in an animation.
|
||||||
|
|
||||||
|
To run this demo:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cargo run -p colors-rgb
|
||||||
|
```
|
@ -1,30 +1,20 @@
|
|||||||
//! # [Ratatui] `Colors_RGB` example
|
//! A Ratatui example that shows the full range of RGB colors that can be displayed in the terminal.
|
||||||
//!
|
//!
|
||||||
//! The latest version of this example is available in the [examples] folder in the repository.
|
//! Requires a terminal that supports 24-bit color (true color) and unicode.
|
||||||
//!
|
//!
|
||||||
//! Please note that the examples are designed to be run against the `main` branch of the Github
|
//! This example also demonstrates how implementing the Widget trait on a mutable reference
|
||||||
//! repository. This means that you may not be able to compile with the latest release version on
|
//! allows the widget to update its state while it is being rendered. This allows the fps
|
||||||
//! crates.io, or the one that you have installed locally.
|
//! widget to update the fps calculation and the colors widget to update a cached version of
|
||||||
|
//! the colors to render instead of recalculating them every frame.
|
||||||
//!
|
//!
|
||||||
//! See the [examples readme] for more information on finding examples that match the version of the
|
//! This is an alternative to using the `StatefulWidget` trait and a separate state struct. It
|
||||||
//! library you are using.
|
//! is useful when the state is only used by the widget and doesn't need to be shared with
|
||||||
|
//! other widgets.
|
||||||
//!
|
//!
|
||||||
//! [Ratatui]: https://github.com/ratatui/ratatui
|
//! This example runs with the Ratatui library code in the branch that you are currently reading.
|
||||||
//! [examples]: https://github.com/ratatui/ratatui/blob/main/examples
|
//! See the [`latest`] branch for the code which works with the most recent Ratatui release.
|
||||||
//! [examples readme]: https://github.com/ratatui/ratatui/blob/main/examples/README.md
|
//!
|
||||||
|
//! [`latest`]: https://github.com/ratatui/ratatui/tree/latest
|
||||||
// This example shows the full range of RGB colors that can be displayed in the terminal.
|
|
||||||
//
|
|
||||||
// Requires a terminal that supports 24-bit color (true color) and unicode.
|
|
||||||
//
|
|
||||||
// This example also demonstrates how implementing the Widget trait on a mutable reference
|
|
||||||
// allows the widget to update its state while it is being rendered. This allows the fps
|
|
||||||
// widget to update the fps calculation and the colors widget to update a cached version of
|
|
||||||
// the colors to render instead of recalculating them every frame.
|
|
||||||
//
|
|
||||||
// This is an alternative to using the `StatefulWidget` trait and a separate state struct. It
|
|
||||||
// is useful when the state is only used by the widget and doesn't need to be shared with
|
|
||||||
// other widgets.
|
|
||||||
|
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
@ -142,11 +142,6 @@ bench = false
|
|||||||
name = "main"
|
name = "main"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
[[example]]
|
|
||||||
name = "colors_rgb"
|
|
||||||
required-features = ["crossterm", "palette"]
|
|
||||||
doc-scrape-examples = true
|
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "constraint-explorer"
|
name = "constraint-explorer"
|
||||||
required-features = ["crossterm"]
|
required-features = ["crossterm"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user