mirror of
https://github.com/uutils/procps.git
synced 2026-05-06 06:06:43 -04:00
chore: bump version of ratatui to 0.30.0
This commit is contained in:
+1
-1
@@ -66,7 +66,7 @@ phf = "0.13.1"
|
||||
phf_codegen = "0.13.0"
|
||||
prettytable-rs = "0.10.0"
|
||||
rand = { version = "0.9.0", features = ["small_rng"] }
|
||||
ratatui = "0.29.0"
|
||||
ratatui = "0.30.0"
|
||||
regex = "1.10.4"
|
||||
rustix = { version = "1.1.2", features = ["fs"] }
|
||||
sysinfo = "0.37.0"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
use ratatui::{
|
||||
buffer::Buffer,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
style::{Style, Stylize},
|
||||
style::Style,
|
||||
symbols::Marker,
|
||||
text::{Line, Text},
|
||||
widgets::{Axis, Block, Borders, Chart, Dataset, GraphType, Paragraph, Widget},
|
||||
|
||||
+24
-30
@@ -3,63 +3,57 @@
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
use ratatui::prelude::Stylize;
|
||||
use ratatui::style::{Color, Styled};
|
||||
use ratatui::style::{Color, Style};
|
||||
|
||||
pub(crate) trait TuiColor<'a, T>: Sized {
|
||||
fn primary(self, colorful: bool) -> T;
|
||||
fn bg_primary(self, colorful: bool) -> T;
|
||||
fn secondary(self, colorful: bool) -> T;
|
||||
fn bg_secondary(self, colorful: bool) -> T;
|
||||
fn error(self, colorful: bool) -> T;
|
||||
/// This is the trait used to adjust the TUI color options
|
||||
pub(crate) trait TuiColorHelper: Sized {
|
||||
fn primary(self, colorful: bool) -> Style;
|
||||
fn bg_primary(self, colorful: bool) -> Style;
|
||||
fn secondary(self, colorful: bool) -> Style;
|
||||
fn bg_secondary(self, colorful: bool) -> Style;
|
||||
fn error(self, colorful: bool) -> Style;
|
||||
}
|
||||
|
||||
impl<'a, T, U> TuiColor<'a, T> for U
|
||||
where
|
||||
U: Styled<Item = T>,
|
||||
{
|
||||
fn primary(self, colorful: bool) -> T {
|
||||
let style = self.style();
|
||||
impl TuiColorHelper for Style {
|
||||
fn primary(self, colorful: bool) -> Style {
|
||||
if colorful {
|
||||
self.red()
|
||||
} else {
|
||||
self.set_style(style)
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn bg_primary(self, colorful: bool) -> T {
|
||||
let style = self.style().fg(Color::Black);
|
||||
fn bg_primary(self, colorful: bool) -> Style {
|
||||
let style = self.fg(Color::Black);
|
||||
if colorful {
|
||||
self.set_style(style.bg(Color::Red))
|
||||
style.bg(Color::Red)
|
||||
} else {
|
||||
self.set_style(style.bg(Color::White))
|
||||
style.bg(Color::White)
|
||||
}
|
||||
}
|
||||
|
||||
fn secondary(self, colorful: bool) -> T {
|
||||
let style = self.style();
|
||||
fn secondary(self, colorful: bool) -> Style {
|
||||
if colorful {
|
||||
self.yellow()
|
||||
} else {
|
||||
self.set_style(style)
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn bg_secondary(self, colorful: bool) -> T {
|
||||
let style = self.style().fg(Color::Black);
|
||||
fn bg_secondary(self, colorful: bool) -> Style {
|
||||
let style = self.fg(Color::Black);
|
||||
if colorful {
|
||||
self.set_style(style.bg(Color::Yellow))
|
||||
style.bg(Color::Yellow)
|
||||
} else {
|
||||
self.set_style(style.bg(Color::White))
|
||||
style.bg(Color::White)
|
||||
}
|
||||
}
|
||||
|
||||
fn error(self, colorful: bool) -> T {
|
||||
let style = self.style();
|
||||
fn error(self, colorful: bool) -> Style {
|
||||
if colorful {
|
||||
self.set_style(style.fg(Color::Black).bg(Color::Red))
|
||||
self.fg(Color::Black).bg(Color::Red)
|
||||
} else {
|
||||
self.set_style(style)
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ pub use input::*;
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::header::{format_memory, Header};
|
||||
use crate::tui::color::TuiColor;
|
||||
use crate::tui::color::TuiColorHelper;
|
||||
use crate::tui::stat::{CpuGraphMode, MemoryGraphMode, TuiStat};
|
||||
use crate::{InfoBar, ProcList};
|
||||
use ratatui::prelude::*;
|
||||
|
||||
Reference in New Issue
Block a user