diff --git a/Cargo.lock b/Cargo.lock index cd3f2d93..4c52a5f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1853,6 +1853,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "modifiers" +version = "0.0.0" +dependencies = [ + "color-eyre", + "crossterm", + "itertools 0.13.0", + "ratatui", +] + [[package]] name = "mouse-drawing" version = "0.0.0" diff --git a/examples/README.md b/examples/README.md index b580a496..f873d011 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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/). +## Modifiers demo + +Shows different types of modifiers. [Source](./apps/modifiers/). + ## Mouse Drawing demo Shows how to handle mouse events. [Source](./apps/mouse-drawing/). diff --git a/examples/apps/modifiers/Cargo.toml b/examples/apps/modifiers/Cargo.toml new file mode 100644 index 00000000..68529df1 --- /dev/null +++ b/examples/apps/modifiers/Cargo.toml @@ -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 diff --git a/examples/apps/modifiers/README.md b/examples/apps/modifiers/README.md new file mode 100644 index 00000000..0be0be1f --- /dev/null +++ b/examples/apps/modifiers/README.md @@ -0,0 +1,9 @@ +# Modifiers demo + +This example shows different types of modifiers. + +To run this demo: + +```shell +cargo run -p modifiers +``` diff --git a/ratatui/examples/modifiers.rs b/examples/apps/modifiers/src/main.rs similarity index 73% rename from ratatui/examples/modifiers.rs rename to examples/apps/modifiers/src/main.rs index 74555ef1..f602768a 100644 --- a/ratatui/examples/modifiers.rs +++ b/examples/apps/modifiers/src/main.rs @@ -1,22 +1,13 @@ -//! # [Ratatui] Modifiers example -//! -//! The latest version of this example is available in the [examples] folder in the repository. -//! -//! 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 -//! crates.io, or the one that you have installed locally. -//! -//! See the [examples readme] for more information on finding examples that match the version of the -//! library you are using. -//! -//! [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. - +/// A Ratatui example that demonstrates how to use modifiers. +/// +/// It will render a grid of combinations of foreground and background colors with all +/// modifiers applied to them. +/// +/// This example runs with the Ratatui library code in the branch that you are currently +/// reading. See the [`latest`] branch for the code which works with the most recent Ratatui +/// release. +/// +/// [`latest`]: https://github.com/ratatui/ratatui/tree/latest use std::{error::Error, iter::once, result}; use itertools::Itertools; diff --git a/ratatui/Cargo.toml b/ratatui/Cargo.toml index 869b5af5..b4f389c2 100644 --- a/ratatui/Cargo.toml +++ b/ratatui/Cargo.toml @@ -147,12 +147,6 @@ bench = false name = "main" 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]] name = "panic" required-features = ["crossterm"]