Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic dimming functionality #2751

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
Update helix-tui/src/buffer.rs
Co-authored-by: yvt <[email protected]>
  • Loading branch information
farwyler and yvt committed Jul 2, 2022
commit a94db20bcb82ea957e04032b3c469289616b50d0
6 changes: 3 additions & 3 deletions helix-tui/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,9 @@ impl Buffer {

/// Apply shade to all cells in area.
///
/// shade = 0 -> set text modifier DIM
/// shade < 0 -> darken rgb color
/// shade > 0 -> lighten rgb color
/// - `shade = 0`: set text modifier `DIM`
/// - `shade < 0`: darken rgb color
/// - `shade > 0`: lighten rgb color
pub fn dim(&mut self, area: Rect, shade: i8) {
let alpha = i32::from(shade).unsigned_abs() << 1;
let (src_factor, dst_factor) = (alpha, 256 - alpha);
Expand Down