pub struct ShadowGradeConfig {
pub fg_dim_strength: f32,
pub bg_dim_strength: f32,
pub fg_desaturate_strength: f32,
pub bg_desaturate_strength: f32,
pub fg_tint_strength: f32,
pub bg_tint_strength: f32,
pub preserve_fg_alpha: bool,
pub preserve_bg_alpha: bool,
pub replacement_char: Option<char>,
}Expand description
Color grading parameters for the grade-underlying shadow compositing mode.
Each strength field ranges from 0.0 (no effect) to 1.0 (maximum).
Effective per-cell strength is field_value * shadow_coverage, where
coverage is derived from the rendered shadow cell’s alpha channels.
Background grading is intentionally stronger than foreground grading in the
dramatic preset to preserve text readability while
making the shadow region clearly visible.
§Example
use tui_vfx_shadow::ShadowGradeConfig;
// Use the recommended dramatic preset
let grade = ShadowGradeConfig::dramatic();
assert!(grade.bg_dim_strength > grade.fg_dim_strength);
// Or configure manually
let custom = ShadowGradeConfig {
fg_dim_strength: 0.15,
bg_dim_strength: 0.40,
..Default::default()
};Fields§
§fg_dim_strength: f32Foreground dimming strength (0.0–1.0).
bg_dim_strength: f32Background dimming strength (0.0–1.0).
fg_desaturate_strength: f32Foreground desaturation strength (0.0–1.0).
bg_desaturate_strength: f32Background desaturation strength (0.0–1.0).
fg_tint_strength: f32Foreground tint-toward-shadow-color strength (0.0–1.0).
bg_tint_strength: f32Background tint-toward-shadow-color strength (0.0–1.0).
preserve_fg_alpha: boolWhen true, preserve the destination foreground alpha channel.
preserve_bg_alpha: boolWhen true, preserve the destination background alpha channel.
replacement_char: Option<char>Optional replacement character for color-inert glyphs (emoji, PUA).
When Some, glyphs that ignore ANSI fg color attributes are replaced
with this character during grading. This prevents bright bitmap glyphs
from creating visual artifacts in dimmed shadow regions.
Set to None to preserve all original glyphs (backward compatible default).
Implementations§
Source§impl ShadowGradeConfig
impl ShadowGradeConfig
Sourcepub const fn dramatic() -> Self
pub const fn dramatic() -> Self
Returns the recommended dramatic grade preset.
This preset is intentionally moderate-to-strong so the shadow region is clearly visible on ordinary RGB terminal cells. Background grading is stronger than foreground grading to maintain text readability.
Numeric values are locked by plan and must not change without a plan update.
Trait Implementations§
Source§impl Clone for ShadowGradeConfig
impl Clone for ShadowGradeConfig
Source§fn clone(&self) -> ShadowGradeConfig
fn clone(&self) -> ShadowGradeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more