-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
Consider changing the brightblack
color and glyph of NULL bytes
#236
Comments
Sounds reasonable, thank you. How does that look like (for different terminal schemes)? |
Thanks. I took a few screenshots of I applied this patch (doesn't include the test change): diff --git a/src/colors.rs b/src/colors.rs
index b76e641..eb5ea0a 100644
--- a/src/colors.rs
+++ b/src/colors.rs
@@ -1,7 +1,7 @@
use owo_colors::{colors, Color};
-pub const COLOR_NULL: &[u8] = colors::BrightBlack::ANSI_FG.as_bytes();
-pub const COLOR_OFFSET: &[u8] = colors::BrightBlack::ANSI_FG.as_bytes();
+pub const COLOR_NULL: &[u8] = colors::Blue::ANSI_FG.as_bytes();
+pub const COLOR_OFFSET: &[u8] = colors::Blue::ANSI_FG.as_bytes();
pub const COLOR_ASCII_PRINTABLE: &[u8] = colors::Cyan::ANSI_FG.as_bytes();
pub const COLOR_ASCII_WHITESPACE: &[u8] = colors::Green::ANSI_FG.as_bytes();
pub const COLOR_ASCII_OTHER: &[u8] = colors::Green::ANSI_FG.as_bytes();
@@ -24,12 +24,12 @@ pub const CP437: [char; 256] = [
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
- // modified to use the ⋄ character instead of ␀
+ // modified to use the ₀ character instead of ␀
// use https://en.wikipedia.org/w/index.php?title=Code_page_437&oldid=978947122
// not ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP437.TXT
// because we want the graphic versions of 01h–1Fh + 7Fh
- '⋄','☺','☻','♥','♦','♣','♠','•','◘','○','◙','♂','♀','♪','♫','☼',
+ '₀','☺','☻','♥','♦','♣','♠','•','◘','○','◙','♂','♀','♪','♫','☼',
'►','◄','↕','‼','¶','§','▬','↨','↑','↓','→','←','∟','↔','▲','▼',
' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',
'0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?',
diff --git a/src/lib.rs b/src/lib.rs
index bae2945..10d6b81 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -27,7 +27,7 @@ pub enum ByteCategory {
#[derive(Copy, Clone, Debug, Default, ValueEnum)]
#[non_exhaustive]
pub enum CharacterTable {
- /// Show printable ASCII characters as-is, '⋄' for NULL bytes, ' ' for
+ /// Show printable ASCII characters as-is, '₀' for NULL bytes, ' ' for
/// space, '_' for other ASCII whitespace, '•' for other ASCII characters,
/// and '×' for non-ASCII bytes.
#[default]
@@ -96,7 +96,7 @@ impl Byte {
use crate::ByteCategory::*;
match character_table {
CharacterTable::Default => match self.category() {
- Null => '⋄',
+ Null => '₀',
AsciiPrintable => self.0 as char,
AsciiWhitespace if self.0 == 0x20 => ' ',
AsciiWhitespace => '_',
diff --git a/src/main.rs b/src/main.rs
index 2e32cff..eef9dd8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -494,7 +494,7 @@ fn print_color_table() -> io::Result<()> {
// NULL bytes
stdout.write_all(COLOR_NULL)?;
- writeln!(stdout, "⋄ NULL bytes (0x00)")?;
+ writeln!(stdout, "₀ NULL bytes (0x00)")?;
stdout.write_all(COLOR_RESET)?;
// ASCII printable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a couple of issues with the display of the offset and NULL bytes. They are not such a big deal for me, because I do a manual build and I apply a patch to fix them, but I thought of bringing them up anyway, for the benefit of other users with similar terminal configurations.
The first one, involves the color.
brightblack
is the background color of the Solarized Dark color scheme, so it becomes invisible on terminals with that configuration. This is a very popular color scheme, and I’m surprised that it hasn’t been brought up already. I would suggest to be changed toblue
, which is a more compatible foreground color, and it’s not used for something else.The second, has to do with the choice of the display character for NULL bytes. The "diamond operator" (U+22C4) is not a very common symbol, and it's not present in some popular fonts, like Terminus and Adobe Source Code Pro, so a fallback font is used and it doesn’t look nice. I think a better choice would be a more common symbol, like "subscript zero" (U+2080).
The text was updated successfully, but these errors were encountered: