comfy_table/style/
mod.rs

1#[cfg(all(feature = "tty", not(feature = "reexport_crossterm")))]
2mod attribute;
3mod cell;
4#[cfg(all(feature = "tty", not(feature = "reexport_crossterm")))]
5mod color;
6mod column;
7/// Contains modifiers, that can be used to alter certain parts of a preset.\
8/// For instance, the [UTF8_ROUND_CORNERS](modifiers::UTF8_ROUND_CORNERS) replaces all corners with round UTF8 box corners.
9pub mod modifiers;
10/// This module provides styling presets for tables.\
11/// Every preset has an example preview.
12pub mod presets;
13mod table;
14
15pub use cell::CellAlignment;
16pub use column::{ColumnConstraint, Width};
17#[cfg(feature = "tty")]
18pub(crate) use styling_enums::{map_attribute, map_color};
19#[cfg(feature = "tty")]
20pub use styling_enums::{Attribute, Color};
21pub use table::{ContentArrangement, TableComponent};
22
23/// Convenience module to have cleaner and "identical" conditional re-exports for style enums.
24#[cfg(all(feature = "tty", not(feature = "reexport_crossterm")))]
25mod styling_enums {
26    pub use super::attribute::*;
27    pub use super::color::*;
28}
29
30/// Re-export the crossterm type directly instead of using the internal mirrored types.
31/// This result in possible ABI incompatibilities when using comfy_table and crossterm in the same
32/// project with different versions, but may also be very convenient for developers.
33#[cfg(all(feature = "tty", feature = "reexport_crossterm"))]
34mod styling_enums {
35    /// Attributes used for styling cell content. Reexport of crossterm's [Attributes](crossterm::style::Attribute) enum.
36    pub use crossterm::style::Attribute;
37    /// Colors used for styling cell content. Reexport of crossterm's [Color](crossterm::style::Color) enum.
38    pub use crossterm::style::Color;
39
40    /// Convenience function to have the same mapping code for reexported types.
41    #[inline]
42    pub(crate) fn map_attribute(attribute: Attribute) -> Attribute {
43        attribute
44    }
45
46    /// Convenience function to have the same mapping code for reexported types.
47    #[inline]
48    pub(crate) fn map_color(color: Color) -> Color {
49        color
50    }
51}