docs(examples): move modifiers example to examples folder (#1654)

This commit is contained in:
Orhun Parmaksız 2025-02-07 04:40:03 +03:00 committed by GitHub
parent 7c40c0bbdd
commit 8127590812
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 48 additions and 25 deletions

10
Cargo.lock generated
View File

@ -1853,6 +1853,16 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "modifiers"
version = "0.0.0"
dependencies = [
"color-eyre",
"crossterm",
"itertools 0.13.0",
"ratatui",
]
[[package]] [[package]]
name = "mouse-drawing" name = "mouse-drawing"
version = "0.0.0" version = "0.0.0"

View File

@ -106,6 +106,10 @@ Shows how to render a form with input fields. [Source](./apps/input-form/).
Shows how to create a simple todo list application. [Source](./apps/todo-list/). Shows how to create a simple todo list application. [Source](./apps/todo-list/).
## Modifiers demo
Shows different types of modifiers. [Source](./apps/modifiers/).
## Mouse Drawing demo ## Mouse Drawing demo
Shows how to handle mouse events. [Source](./apps/mouse-drawing/). Shows how to handle mouse events. [Source](./apps/mouse-drawing/).

View File

@ -0,0 +1,15 @@
[package]
name = "modifiers"
publish = false
license.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
color-eyre.workspace = true
crossterm.workspace = true
itertools.workspace = true
ratatui.workspace = true
[lints]
workspace = true

View File

@ -0,0 +1,9 @@
# Modifiers demo
This example shows different types of modifiers.
To run this demo:
```shell
cargo run -p modifiers
```

View File

@ -1,22 +1,13 @@
//! # [Ratatui] Modifiers example /// A Ratatui example that demonstrates how to use modifiers.
//! ///
//! The latest version of this example is available in the [examples] folder in the repository. /// It will render a grid of combinations of foreground and background colors with all
//! /// modifiers applied to them.
//! Please note that the examples are designed to be run against the `main` branch of the Github ///
//! repository. This means that you may not be able to compile with the latest release version on /// This example runs with the Ratatui library code in the branch that you are currently
//! crates.io, or the one that you have installed locally. /// reading. See the [`latest`] branch for the code which works with the most recent Ratatui
//! /// release.
//! See the [examples readme] for more information on finding examples that match the version of the ///
//! library you are using. /// [`latest`]: https://github.com/ratatui/ratatui/tree/latest
//!
//! [Ratatui]: https://github.com/ratatui/ratatui
//! [examples]: https://github.com/ratatui/ratatui/blob/main/examples
//! [examples readme]: https://github.com/ratatui/ratatui/blob/main/examples/README.md
// This example is useful for testing how your terminal emulator handles different modifiers.
// It will render a grid of combinations of foreground and background colors with all
// modifiers applied to them.
use std::{error::Error, iter::once, result}; use std::{error::Error, iter::once, result};
use itertools::Itertools; use itertools::Itertools;

View File

@ -147,12 +147,6 @@ bench = false
name = "main" name = "main"
harness = false harness = false
[[example]]
name = "modifiers"
required-features = ["crossterm"]
# this example is a bit verbose, so we don't want to include it in the docs
doc-scrape-examples = false
[[example]] [[example]]
name = "panic" name = "panic"
required-features = ["crossterm"] required-features = ["crossterm"]