This commit is contained in:
Timon_Post 2019-05-04 13:03:18 +02:00
parent e1a46d5fb5
commit ee406d47fa
5 changed files with 23 additions and 12 deletions

View File

@ -388,10 +388,11 @@ pub fn print_supported_colors() {
} }
} }
fn main() { pub fn reset_fg_and_bg() {
println!("{}", Colored::Bg(Color::Red));
println!("{}", Colored::Fg(Color::Blue));
println!("{}", Colored::Fg(Color::Reset)); println!("{}", Colored::Fg(Color::Reset));
println!("{}", Colored::Bg(Color::Reset)); println!("{}", Colored::Bg(Color::Reset));
} }
fn main() {
print_all_background_colors_with_method()
}

View File

@ -119,8 +119,9 @@ impl ITerminalColor for WinApiColor {
// init the original color in case it is not set. // init the original color in case it is not set.
let mut original_color = original_console_color(); let mut original_color = original_console_color();
const mask: u16 = BG_INTENSITY | BG_RED | BG_GREEN | BG_BLUE; const REMOVE_BG_MASK: u16 = BG_INTENSITY | BG_RED | BG_GREEN | BG_BLUE;
original_color &= !(mask); // remove all background values from the original color, we don't want to reset those.
original_color &= !(REMOVE_BG_MASK);
original_color original_color
} }
@ -153,8 +154,9 @@ impl ITerminalColor for WinApiColor {
// init the original color in case it is not set. // init the original color in case it is not set.
let mut original_color = original_console_color(); let mut original_color = original_console_color();
const mask: u16 = FG_INTENSITY | FG_RED | FG_GREEN | FG_BLUE; const REMOVE_FG_MASK: u16 = FG_INTENSITY | FG_RED | FG_GREEN | FG_BLUE;
original_color &= !(mask); // remove all foreground values from the original color, we don't want to reset those.
original_color &= !(REMOVE_FG_MASK);
original_color original_color
} }
/* WinApi will be used for systems that do not support ANSI, those are windows version less then 10. RGB and 255 (AnsiBValue) colors are not supported in that case.*/ /* WinApi will be used for systems that do not support ANSI, those are windows version less then 10. RGB and 255 (AnsiBValue) colors are not supported in that case.*/

View File

@ -1,3 +1,9 @@
# Changes crossterm_input 0.9.4
- Reset foreground and background color individually. [PR](https://github.com/TimonPost/crossterm/pull/138)
- Backtap input support. [PR](https://github.com/TimonPost/crossterm/pull/129)
- Corrected white/grey and added dark grey.
- Fixed getting cursor position with raw screen enabled. [PR](https://github.com/TimonPost/crossterm/pull/134)
# Changes crossterm_input 0.9.3 # Changes crossterm_input 0.9.3
- Removed println from `SyncReader` - Removed println from `SyncReader`

View File

@ -4,7 +4,7 @@ And I don't think it has to do anything with crossterm but it has to do whit how
# Winapi-problems # Winapi-problems
- Power shell does not interpreter 'DarkYellow' and is instead using gray instead, cmd is working perfectly fine. - Power shell does not interpreter 'DarkYellow' and is instead using gray instead, cmd is working perfectly fine.
- Power shell inserts an '\n' (enter) when the program starts, this enter is the one you pressed when running the command. - Power shell inserts an '\n' (enter) when the program starts, this enter is the one you pressed when running the command.
- After the program ran, power shell will reset the background color. - After the program ran, power shell will reset the background and foreground colors.
# UNIX-terminals # UNIX-terminals
The Arc and Manjaro KDE Konsole's are not seeming to resize the terminal instead they are resizing the buffer. The Arc and Manjaro KDE Konsole's are not seeming to resize the terminal instead they are resizing the buffer.

View File

@ -405,7 +405,9 @@ pub fn print_supported_colors() {
} }
} }
fn main() { pub fn reset_fg_and_bg() {
print_all_background_colors_with_method(); println!("{}", Colored::Fg(Color::Reset));
print_all_foreground_colors_with_method(); println!("{}", Colored::Bg(Color::Reset));
} }
fn main() {}