Open djbpitt opened 2 years ago
Can you paste the output of
$ ls --color=always path/to/file | xxd
$ fd --color=always -p path/to/file | xxd
where path/to/file
is a file with different colors for ls
and fd
?
Thank you for the quick response. Here is the output:
@.*** pr-app % ls --color=always | xxd 00000000: 4c49 4345 4e53 450a 5245 4144 4d45 2e6d LICENSE.README.m 00000010: 640a 1b5b 3334 6d62 7569 6c64 1b5b 3339 d..[34mbuild.[39 00000020: 3b34 396d 1b5b 306d 0a62 7569 6c64 2e78 ;49m.[0m.build.x 00000030: 6d6c 0a63 6f6c 6c65 6374 696f 6e2e 7863 ml.collection.xc 00000040: 6f6e 660a 636f 6e74 726f 6c6c 6572 2e78 onf.controller.x 00000050: 716c 0a63 7970 7265 7373 2e6a 736f 6e0a ql.cypress.json. 00000060: 1b5b 3334 6d64 6174 611b 5b33 393b 3439 .[34mdata.[39;49 00000070: 6d1b 5b30 6d0a 1b5b 3334 6d64 6576 1b5b m.[0m..[34mdev.[ 00000080: 3339 3b34 396d 1b5b 306d 0a65 7870 6174 39;49m.[0m.expat 00000090: 682d 706b 672e 786d 6c0a 6963 6f6e 2e70 h-pkg.xml.icon.p 000000a0: 6e67 0a1b 5b33 346d 6d6f 6475 6c65 731b ng..[34mmodules. 000000b0: 5b33 393b 3439 6d1b 5b30 6d0a 7061 636b [39;49m.[0m.pack 000000c0: 6167 652d 6c6f 636b 2e6a 736f 6e0a 7061 age-lock.json.pa 000000d0: 636b 6167 652e 6a73 6f6e 0a70 6f73 742d ckage.json.post- 000000e0: 696e 7374 616c 6c2e 7871 6c0a 1b5b 3334 install.xql..[34 000000f0: 6d70 722d 6170 702d 7475 746f 7269 616c mpr-app-tutorial 00000100: 731b 5b33 393b 3439 6d1b 5b30 6d0a 7072 s.[39;49m.[0m.pr 00000110: 2d61 7070 2e63 6f64 652d 776f 726b 7370 -app.code-worksp 00000120: 6163 650a 1b5b 3331 6d70 7265 2d69 6e73 ace..[31mpre-ins 00000130: 7461 6c6c 2e78 716c 1b5b 3339 3b34 396d tall.xql.[39;49m 00000140: 1b5b 306d 0a72 6570 6f2e 786d 6c0a 1b5b .[0m.repo.xml..[ 00000150: 3334 6d72 6573 6f75 7263 6573 1b5b 3339 34mresources.[39 00000160: 3b34 396d 1b5b 306d 0a1b 5b33 346d 7370 ;49m.[0m..[34msp 00000170: 7269 6e74 5f72 6570 6f72 7473 1b5b 3339 rint_reports.[39 00000180: 3b34 396d 1b5b 306d 0a1b 5b33 346d 7465 ;49m.[0m..[34mte 00000190: 7374 1b5b 3339 3b34 396d 1b5b 306d 0a1b st.[39;49m.[0m.. 000001a0: 5b33 346d 7465 7374 2d74 6d70 1b5b 3339 [34mtest-tmp.[39 000001b0: 3b34 396d 1b5b 306d 0a1b 5b33 346d 7669 ;49m.[0m..[34mvi 000001c0: 6577 731b 5b33 393b 3439 6d1b 5b30 6d0a ews.[39;49m.[0m.
@.*** pr-app % fd --color=always -d 1 | xxd 00000000: 1b5b 3338 3b35 3b38 316d 2e2f 1b5b 306d .[38;5;81m./.[0m 00000010: 1b5b 3338 3b35 3b32 3439 6d4c 4943 454e .[38;5;249mLICEN 00000020: 5345 1b5b 306d 0a1b 5b33 383b 353b 3831 SE.[0m..[38;5;81 00000030: 6d2e 2f1b 5b30 6d1b 5b34 383b 353b 3138 m./.[0m.[48;5;18 00000040: 363b 3338 3b35 3b31 366d 5245 4144 4d45 6;38;5;16mREADME 00000050: 2e6d 641b 5b30 6d0a 1b5b 3338 3b35 3b38 .md.[0m..[38;5;8 00000060: 316d 2e2f 1b5b 306d 6275 696c 642e 786d 1m./.[0mbuild.xm 00000070: 6c0a 1b5b 3338 3b35 3b38 316d 2e2f 1b5b l..[38;5;81m./.[ 00000080: 306d 636f 6c6c 6563 7469 6f6e 2e78 636f 0mcollection.xco 00000090: 6e66 0a1b 5b33 383b 353b 3831 6d2e 2f1b nf..[38;5;81m./. 000000a0: 5b30 6d63 6f6e 7472 6f6c 6c65 722e 7871 [0mcontroller.xq 000000b0: 6c0a 1b5b 3338 3b35 3b38 316d 2e2f 1b5b l..[38;5;81m./.[ 000000c0: 306d 1b5b 3338 3b35 3b31 3439 6d63 7970 0m.[38;5;149mcyp 000000d0: 7265 7373 2e6a 736f 6e1b 5b30 6d0a 1b5b ress.json.[0m..[ 000000e0: 3338 3b35 3b38 316d 2e2f 1b5b 306d 1b5b 38;5;81m./.[0m.[ 000000f0: 3338 3b35 3b38 316d 6461 7461 1b5b 306d 38;5;81mdata.[0m 00000100: 1b5b 3338 3b35 3b38 316d 2f1b 5b30 6d0a .[38;5;81m/.[0m. 00000110: 1b5b 3338 3b35 3b38 316d 2e2f 1b5b 306d .[38;5;81m./.[0m 00000120: 1b5b 3338 3b35 3b38 316d 6465 761b 5b30 .[38;5;81mdev.[0 00000130: 6d1b 5b33 383b 353b 3831 6d2f 1b5b 306d m.[38;5;81m/.[0m 00000140: 0a1b 5b33 383b 353b 3831 6d2e 2f1b 5b30 ..[38;5;81m./.[0 00000150: 6d65 7870 6174 682d 706b 672e 786d 6c0a mexpath-pkg.xml. 00000160: 1b5b 3338 3b35 3b38 316d 2e2f 1b5b 306d .[38;5;81m./.[0m 00000170: 1b5b 3338 3b35 3b32 3038 6d69 636f 6e2e .[38;5;208micon. 00000180: 706e 671b 5b30 6d0a 1b5b 3338 3b35 3b38 png.[0m..[38;5;8 00000190: 316d 2e2f 1b5b 306d 1b5b 3338 3b35 3b38 1m./.[0m.[38;5;8 000001a0: 316d 6d6f 6475 6c65 731b 5b30 6d1b 5b33 1mmodules.[0m.[3 000001b0: 383b 353b 3831 6d2f 1b5b 306d 0a1b 5b33 8;5;81m/.[0m..[3 000001c0: 383b 353b 3831 6d2e 2f1b 5b30 6d1b 5b33 8;5;81m./.[0m.[3 000001d0: 383b 353b 3234 336d 7061 636b 6167 652d 8;5;243mpackage- 000001e0: 6c6f 636b 2e6a 736f 6e1b 5b30 6d0a 1b5b lock.json.[0m..[ 000001f0: 3338 3b35 3b38 316d 2e2f 1b5b 306d 1b5b 38;5;81m./.[0m.[ 00000200: 3338 3b35 3b31 3439 6d70 6163 6b61 6765 38;5;149mpackage 00000210: 2e6a 736f 6e1b 5b30 6d0a 1b5b 3338 3b35 .json.[0m..[38;5 00000220: 3b38 316d 2e2f 1b5b 306d 706f 7374 2d69 ;81m./.[0mpost-i 00000230: 6e73 7461 6c6c 2e78 716c 0a1b 5b33 383b nstall.xql..[38; 00000240: 353b 3831 6d2e 2f1b 5b30 6d1b 5b33 383b 5;81m./.[0m.[38; 00000250: 353b 3831 6d70 722d 6170 702d 7475 746f 5;81mpr-app-tuto 00000260: 7269 616c 731b 5b30 6d1b 5b33 383b 353b rials.[0m.[38;5; 00000270: 3831 6d2f 1b5b 306d 0a1b 5b33 383b 353b 81m/.[0m..[38;5; 00000280: 3831 6d2e 2f1b 5b30 6d1b 5b31 3b33 383b 81m./.[0m.[1;38; 00000290: 353b 3230 336d 7072 652d 696e 7374 616c 5;203mpre-instal 000002a0: 6c2e 7871 6c1b 5b30 6d0a 1b5b 3338 3b35 l.xql.[0m..[38;5 000002b0: 3b38 316d 2e2f 1b5b 306d 7265 706f 2e78 ;81m./.[0mrepo.x 000002c0: 6d6c 0a1b 5b33 383b 353b 3831 6d2e 2f1b ml..[38;5;81m./. 000002d0: 5b30 6d1b 5b33 383b 353b 3831 6d72 6573 [0m.[38;5;81mres 000002e0: 6f75 7263 6573 1b5b 306d 1b5b 3338 3b35 ources.[0m.[38;5 000002f0: 3b38 316d 2f1b 5b30 6d0a 1b5b 3338 3b35 ;81m/.[0m..[38;5 00000300: 3b38 316d 2e2f 1b5b 306d 1b5b 3338 3b35 ;81m./.[0m.[38;5 00000310: 3b38 316d 7370 7269 6e74 5f72 6570 6f72 ;81msprint_repor 00000320: 7473 1b5b 306d 1b5b 3338 3b35 3b38 316d ts.[0m.[38;5;81m 00000330: 2f1b 5b30 6d0a 1b5b 3338 3b35 3b38 316d /.[0m..[38;5;81m 00000340: 2e2f 1b5b 306d 1b5b 3338 3b35 3b38 316d ./.[0m.[38;5;81m 00000350: 7465 7374 1b5b 306d 1b5b 3338 3b35 3b38 test.[0m.[38;5;8 00000360: 316d 2f1b 5b30 6d0a 1b5b 3338 3b35 3b38 1m/.[0m..[38;5;8 00000370: 316d 2e2f 1b5b 306d 1b5b 3338 3b35 3b38 1m./.[0m.[38;5;8 00000380: 316d 7465 7374 2d74 6d70 1b5b 306d 1b5b 1mtest-tmp.[0m.[ 00000390: 3338 3b35 3b38 316d 2f1b 5b30 6d0a 1b5b 38;5;81m/.[0m..[ 000003a0: 3338 3b35 3b38 316d 2e2f 1b5b 306d 1b5b 38;5;81m./.[0m.[ 000003b0: 3338 3b35 3b38 316d 7669 6577 731b 5b30 38;5;81mviews.[0 000003c0: 6d1b 5b33 383b 353b 3831 6d2f 1b5b 306d m.[38;5;81m/.[0m 000003d0: 0a .
On Sun, Jun 5, 2022 at 6:57 PM Tavian Barnes @.***> wrote:
Can you paste the output of
$ ls --color=always path/to/file | xxd $ fd --color=always -p path/to/file | xxd
where path/to/file is a file with different colors for ls and fd?
— Reply to this email directly, view it on GitHub https://github.com/sharkdp/fd/issues/1031#issuecomment-1146898178, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPRXXD3DWPH6EVPK4CHNKDVNUWGFANCNFSM5X5IGOAA . You are receiving this because you authored the thread.Message ID: @.***>
Ah I forgot fd
has a default color scheme that's used when LS_COLORS
isn't set. If you set LS_COLORS
to anything (e.g. the empty string), it will match GNU ls
.
@tavianator I set LS_COLORS
to the empty string and I see just two shades of gray. Here's the output of both fd
and ls
:
djb@koala-4 pr-app % set | grep LS_COLORS
LS_COLORS=''
djb@koala-4 pr-app % fd --color=always -d 1 | xxd
00000000: 1b5b 313b 3334 6d2e 2f1b 5b30 6d4c 4943 .[1;34m./.[0mLIC
00000010: 454e 5345 0a1b 5b31 3b33 346d 2e2f 1b5b ENSE..[1;34m./.[
00000020: 306d 5245 4144 4d45 2e6d 640a 1b5b 313b 0mREADME.md..[1;
00000030: 3334 6d2e 2f1b 5b30 6d62 7569 6c64 2e78 34m./.[0mbuild.x
00000040: 6d6c 0a1b 5b31 3b33 346d 2e2f 1b5b 306d ml..[1;34m./.[0m
00000050: 636f 6c6c 6563 7469 6f6e 2e78 636f 6e66 collection.xconf
00000060: 0a1b 5b31 3b33 346d 2e2f 1b5b 306d 636f ..[1;34m./.[0mco
00000070: 6e74 726f 6c6c 6572 2e78 716c 0a1b 5b31 ntroller.xql..[1
00000080: 3b33 346d 2e2f 1b5b 306d 6379 7072 6573 ;34m./.[0mcypres
00000090: 732e 6a73 6f6e 0a1b 5b31 3b33 346d 2e2f s.json..[1;34m./
000000a0: 1b5b 306d 1b5b 313b 3334 6d64 6174 611b .[0m.[1;34mdata.
000000b0: 5b30 6d1b 5b31 3b33 346d 2f1b 5b30 6d0a [0m.[1;34m/.[0m.
000000c0: 1b5b 313b 3334 6d2e 2f1b 5b30 6d1b 5b31 .[1;34m./.[0m.[1
000000d0: 3b33 346d 6465 761b 5b30 6d1b 5b31 3b33 ;34mdev.[0m.[1;3
000000e0: 346d 2f1b 5b30 6d0a 1b5b 313b 3334 6d2e 4m/.[0m..[1;34m.
000000f0: 2f1b 5b30 6d65 7870 6174 682d 706b 672e /.[0mexpath-pkg.
00000100: 786d 6c0a 1b5b 313b 3334 6d2e 2f1b 5b30 xml..[1;34m./.[0
00000110: 6d69 636f 6e2e 706e 670a 1b5b 313b 3334 micon.png..[1;34
00000120: 6d2e 2f1b 5b30 6d1b 5b31 3b33 346d 6d6f m./.[0m.[1;34mmo
00000130: 6475 6c65 731b 5b30 6d1b 5b31 3b33 346d dules.[0m.[1;34m
00000140: 2f1b 5b30 6d0a 1b5b 313b 3334 6d2e 2f1b /.[0m..[1;34m./.
00000150: 5b30 6d70 6163 6b61 6765 2d6c 6f63 6b2e [0mpackage-lock.
00000160: 6a73 6f6e 0a1b 5b31 3b33 346d 2e2f 1b5b json..[1;34m./.[
00000170: 306d 7061 636b 6167 652e 6a73 6f6e 0a1b 0mpackage.json..
00000180: 5b31 3b33 346d 2e2f 1b5b 306d 706f 7374 [1;34m./.[0mpost
00000190: 2d69 6e73 7461 6c6c 2e78 716c 0a1b 5b31 -install.xql..[1
000001a0: 3b33 346d 2e2f 1b5b 306d 1b5b 313b 3334 ;34m./.[0m.[1;34
000001b0: 6d70 722d 6170 702d 7475 746f 7269 616c mpr-app-tutorial
000001c0: 731b 5b30 6d1b 5b31 3b33 346d 2f1b 5b30 s.[0m.[1;34m/.[0
000001d0: 6d0a 1b5b 313b 3334 6d2e 2f1b 5b30 6d1b m..[1;34m./.[0m.
000001e0: 5b31 3b33 326d 7072 652d 696e 7374 616c [1;32mpre-instal
000001f0: 6c2e 7871 6c1b 5b30 6d0a 1b5b 313b 3334 l.xql.[0m..[1;34
00000200: 6d2e 2f1b 5b30 6d72 6570 6f2e 786d 6c0a m./.[0mrepo.xml.
00000210: 1b5b 313b 3334 6d2e 2f1b 5b30 6d1b 5b31 .[1;34m./.[0m.[1
00000220: 3b33 346d 7265 736f 7572 6365 731b 5b30 ;34mresources.[0
00000230: 6d1b 5b31 3b33 346d 2f1b 5b30 6d0a 1b5b m.[1;34m/.[0m..[
00000240: 313b 3334 6d2e 2f1b 5b30 6d1b 5b31 3b33 1;34m./.[0m.[1;3
00000250: 346d 7370 7269 6e74 5f72 6570 6f72 7473 4msprint_reports
00000260: 1b5b 306d 1b5b 313b 3334 6d2f 1b5b 306d .[0m.[1;34m/.[0m
00000270: 0a1b 5b31 3b33 346d 2e2f 1b5b 306d 1b5b ..[1;34m./.[0m.[
00000280: 313b 3334 6d74 6573 741b 5b30 6d1b 5b31 1;34mtest.[0m.[1
00000290: 3b33 346d 2f1b 5b30 6d0a 1b5b 313b 3334 ;34m/.[0m..[1;34
000002a0: 6d2e 2f1b 5b30 6d1b 5b31 3b33 346d 7465 m./.[0m.[1;34mte
000002b0: 7374 2d74 6d70 1b5b 306d 1b5b 313b 3334 st-tmp.[0m.[1;34
000002c0: 6d2f 1b5b 306d 0a1b 5b31 3b33 346d 2e2f m/.[0m..[1;34m./
000002d0: 1b5b 306d 1b5b 313b 3334 6d76 6965 7773 .[0m.[1;34mviews
000002e0: 1b5b 306d 1b5b 313b 3334 6d2f 1b5b 306d .[0m.[1;34m/.[0m
000002f0: 0a
djb@koala-4 pr-app % ls -l --color=always | xxd
00000000: 746f 7461 6c20 3939 3336 0a2d 7277 2d72 total 9936.-rw-r
00000010: 2d2d 722d 2d20 2020 3120 646a 6220 2073 --r-- 1 djb s
00000020: 7461 6666 2020 2020 2031 3132 3520 5365 taff 1125 Se
00000030: 7020 3236 2020 3230 3231 204c 4943 454e p 26 2021 LICEN
00000040: 5345 0a2d 7277 2d72 2d2d 722d 2d20 2020 SE.-rw-r--r--
00000050: 3120 646a 6220 2073 7461 6666 2020 2020 1 djb staff
00000060: 2033 3038 3520 4d61 7920 3239 2031 333a 3085 May 29 13:
00000070: 3533 2052 4541 444d 452e 6d64 0a64 7277 53 README.md.drw
00000080: 7872 2d78 722d 7820 2020 3420 646a 6220 xr-xr-x 4 djb
00000090: 2073 7461 6666 2020 2020 2020 3132 3820 staff 128
000000a0: 5365 7020 3236 2020 3230 3231 201b 5b33 Sep 26 2021 .[3
000000b0: 346d 6275 696c 641b 5b33 393b 3439 6d1b 4mbuild.[39;49m.
000000c0: 5b30 6d0a 2d72 772d 722d 2d72 2d2d 2020 [0m.-rw-r--r--
000000d0: 2031 2064 6a62 2020 7374 6166 6620 2020 1 djb staff
000000e0: 2020 3131 3832 2053 6570 2032 3620 2032 1182 Sep 26 2
000000f0: 3032 3120 6275 696c 642e 786d 6c0a 2d72 021 build.xml.-r
00000100: 772d 722d 2d72 2d2d 2020 2031 2064 6a62 w-r--r-- 1 djb
00000110: 2020 7374 6166 6620 2020 2020 3433 3933 staff 4393
00000120: 204a 756e 2020 3620 3130 3a33 3020 636f Jun 6 10:30 co
00000130: 6c6c 6563 7469 6f6e 2e78 636f 6e66 0a2d llection.xconf.-
00000140: 7277 2d72 2d2d 722d 2d20 2020 3120 646a rw-r--r-- 1 dj
00000150: 6220 2073 7461 6666 2020 2020 2031 3632 b staff 162
00000160: 3220 4d61 7920 3331 2031 313a 3238 2063 2 May 31 11:28 c
00000170: 6f6e 7472 6f6c 6c65 722e 7871 6c0a 2d72 ontroller.xql.-r
00000180: 772d 722d 2d72 2d2d 2020 2031 2064 6a62 w-r--r-- 1 djb
00000190: 2020 7374 6166 6620 2020 2020 2033 3138 staff 318
000001a0: 2053 6570 2032 3620 2032 3032 3120 6379 Sep 26 2021 cy
000001b0: 7072 6573 732e 6a73 6f6e 0a64 7277 7872 press.json.drwxr
000001c0: 2d78 722d 7820 2020 3520 646a 6220 2073 -xr-x 5 djb s
000001d0: 7461 6666 2020 2020 2020 3136 3020 4a75 taff 160 Ju
000001e0: 6e20 2036 2031 303a 3330 201b 5b33 346d n 6 10:30 .[34m
000001f0: 6461 7461 1b5b 3339 3b34 396d 1b5b 306d data.[39;49m.[0m
00000200: 0a64 7277 7872 2d78 722d 7820 2031 3520 .drwxr-xr-x 15
00000210: 646a 6220 2073 7461 6666 2020 2020 2020 djb staff
00000220: 3438 3020 4a75 6e20 2036 2031 303a 3330 480 Jun 6 10:30
00000230: 201b 5b33 346d 6465 761b 5b33 393b 3439 .[34mdev.[39;49
00000240: 6d1b 5b30 6d0a 2d72 772d 722d 2d72 2d2d m.[0m.-rw-r--r--
00000250: 2020 2031 2064 6a62 2020 7374 6166 6620 1 djb staff
00000260: 2020 2020 2033 3137 2053 6570 2032 3620 317 Sep 26
00000270: 2032 3032 3120 6578 7061 7468 2d70 6b67 2021 expath-pkg
00000280: 2e78 6d6c 0a2d 7277 2d72 2d2d 722d 2d20 .xml.-rw-r--r--
00000290: 2020 3120 646a 6220 2073 7461 6666 2020 1 djb staff
000002a0: 3438 3436 3138 3420 5365 7020 3236 2020 4846184 Sep 26
000002b0: 3230 3231 2069 636f 6e2e 706e 670a 6472 2021 icon.png.dr
000002c0: 7778 722d 7872 2d78 2020 3132 2064 6a62 wxr-xr-x 12 djb
000002d0: 2020 7374 6166 6620 2020 2020 2033 3834 staff 384
000002e0: 204a 756e 2020 3620 3130 3a33 3020 1b5b Jun 6 10:30 .[
000002f0: 3334 6d6d 6f64 756c 6573 1b5b 3339 3b34 34mmodules.[39;4
00000300: 396d 1b5b 306d 0a2d 7277 2d72 2d2d 722d 9m.[0m.-rw-r--r-
00000310: 2d20 2020 3120 646a 6220 2073 7461 6666 - 1 djb staff
00000320: 2020 2031 3830 3934 3620 4a75 6e20 2036 180946 Jun 6
00000330: 2031 303a 3330 2070 6163 6b61 6765 2d6c 10:30 package-l
00000340: 6f63 6b2e 6a73 6f6e 0a2d 7277 2d72 2d2d ock.json.-rw-r--
00000350: 722d 2d20 2020 3120 646a 6220 2073 7461 r-- 1 djb sta
00000360: 6666 2020 2020 2020 3933 3020 4a75 6e20 ff 930 Jun
00000370: 2033 2031 323a 3233 2070 6163 6b61 6765 3 12:23 package
00000380: 2e6a 736f 6e0a 2d72 772d 722d 2d72 2d2d .json.-rw-r--r--
00000390: 2020 2031 2064 6a62 2020 7374 6166 6620 1 djb staff
000003a0: 2020 2020 2035 3333 2053 6570 2032 3620 533 Sep 26
000003b0: 2032 3032 3120 706f 7374 2d69 6e73 7461 2021 post-insta
000003c0: 6c6c 2e78 716c 0a64 7277 7872 2d78 722d ll.xql.drwxr-xr-
000003d0: 7820 2031 3720 646a 6220 2073 7461 6666 x 17 djb staff
000003e0: 2020 2020 2020 3534 3420 4a75 6e20 2033 544 Jun 3
000003f0: 2031 313a 3139 201b 5b33 346d 7072 2d61 11:19 .[34mpr-a
00000400: 7070 2d74 7574 6f72 6961 6c73 1b5b 3339 pp-tutorials.[39
00000410: 3b34 396d 1b5b 306d 0a2d 7277 2d72 2d2d ;49m.[0m.-rw-r--
00000420: 722d 2d20 2020 3120 646a 6220 2073 7461 r-- 1 djb sta
00000430: 6666 2020 2020 2020 2034 3320 5365 7020 ff 43 Sep
00000440: 3236 2020 3230 3231 2070 722d 6170 702e 26 2021 pr-app.
00000450: 636f 6465 2d77 6f72 6b73 7061 6365 0a2d code-workspace.-
00000460: 7277 7872 2d78 722d 7820 2020 3120 646a rwxr-xr-x 1 dj
00000470: 6220 2073 7461 6666 2020 2020 2031 3234 b staff 124
00000480: 3320 5365 7020 3236 2020 3230 3231 201b 3 Sep 26 2021 .
00000490: 5b33 316d 7072 652d 696e 7374 616c 6c2e [31mpre-install.
000004a0: 7871 6c1b 5b33 393b 3439 6d1b 5b30 6d0a xql.[39;49m.[0m.
000004b0: 2d72 772d 722d 2d72 2d2d 2020 2031 2064 -rw-r--r-- 1 d
000004c0: 6a62 2020 7374 6166 6620 2020 2020 2034 jb staff 4
000004d0: 3538 2053 6570 2032 3620 2032 3032 3120 58 Sep 26 2021
000004e0: 7265 706f 2e78 6d6c 0a64 7277 7872 2d78 repo.xml.drwxr-x
000004f0: 722d 7820 2020 3420 646a 6220 2073 7461 r-x 4 djb sta
00000500: 6666 2020 2020 2020 3132 3820 4170 7220 ff 128 Apr
00000510: 3238 2031 323a 3430 201b 5b33 346d 7265 28 12:40 .[34mre
00000520: 736f 7572 6365 731b 5b33 393b 3439 6d1b sources.[39;49m.
00000530: 5b30 6d0a 6472 7778 722d 7872 2d78 2020 [0m.drwxr-xr-x
00000540: 3231 2064 6a62 2020 7374 6166 6620 2020 21 djb staff
00000550: 2020 2036 3732 204d 6179 2032 3920 3133 672 May 29 13
00000560: 3a35 3320 1b5b 3334 6d73 7072 696e 745f :53 .[34msprint_
00000570: 7265 706f 7274 731b 5b33 393b 3439 6d1b reports.[39;49m.
00000580: 5b30 6d0a 6472 7778 722d 7872 2d78 2020 [0m.drwxr-xr-x
00000590: 2035 2064 6a62 2020 7374 6166 6620 2020 5 djb staff
000005a0: 2020 2031 3630 2053 6570 2032 3620 2032 160 Sep 26 2
000005b0: 3032 3120 1b5b 3334 6d74 6573 741b 5b33 021 .[34mtest.[3
000005c0: 393b 3439 6d1b 5b30 6d0a 6472 7778 722d 9;49m.[0m.drwxr-
000005d0: 7872 2d78 2020 2035 2064 6a62 2020 7374 xr-x 5 djb st
000005e0: 6166 6620 2020 2020 2031 3630 204a 756e aff 160 Jun
000005f0: 2020 3620 3130 3a33 3020 1b5b 3334 6d74 6 10:30 .[34mt
00000600: 6573 742d 746d 701b 5b33 393b 3439 6d1b est-tmp.[39;49m.
00000610: 5b30 6d0a 6472 7778 722d 7872 2d78 2020 [0m.drwxr-xr-x
00000620: 3131 2064 6a62 2020 7374 6166 6620 2020 11 djb staff
00000630: 2020 2033 3532 204d 6179 2033 3120 3131 352 May 31 11
00000640: 3a32 3420 1b5b 3334 6d76 6965 7773 1b5b :24 .[34mviews.[
00000650: 3339 3b34 396d 1b5b 306d 0a 39;49m.[0m.
Do you mind trying it with both ls
and fd
command lines that match only a single file? It would be easier to compare that way.
Also, can you paste the value of the TERM
environment variable? Thanks
@tavianator
In the first tests below, I'm in a test
directory that contains a single regular file called stuff
.
djb@koala-4 test % set | grep -w LS_COLORS
LS_COLORS=''
djb@koala-4 test % set | grep -w TERM
TERM=xterm-256color
djb@koala-4 test % ls --color=always | xxd
00000000: 7374 7566 660a stuff.
djb@koala-4 test % fd --color=always | xxd
00000000: 1b5b 313b 3334 6d2e 2f1b 5b30 6d73 7475 .[1;34m./.[0mstu
00000010: 6666 0a ff.
Apparently regular files are not colored by ls
with my settings, but when I change stuff
from a regular file to a directory I see:
djb@koala-4 test % ls --color=always | xxd
00000000: 1b5b 3334 6d73 7475 6666 1b5b 3339 3b34 .[34mstuff.[39;4
00000010: 396d 1b5b 306d 0a 9m.[0m.
djb@koala-4 test % fd --color=always | xxd
00000000: 1b5b 313b 3334 6d2e 2f1b 5b30 6d1b 5b31 .[1;34m./.[0m.[1
00000010: 3b33 346d 7374 7566 661b 5b30 6d1b 5b31 ;34mstuff.[0m.[1
00000020: 3b33 346d 2f1b 5b30 6d0a ;34m/.[0m.
Ah okay, I see. ls
is not bolding things by default, while fd
is. I'm guessing you're not using GNU ls
, since its defaults should match fd
. I can reproduce by switching to Solarized Light and running
What's happening is that most terminal emulators use the "intense" color palette when rendering bold text. But the Solarized Light "intense" colors are pretty monochrome (except for red, for some reason). You can use the 256-color escape sequence instead to force it to use the regular palette:
Here's a Konsole bug about this, btw: https://bugs.kde.org/show_bug.cgi?id=405345. Looking back at your original post, what if you uncheck "Brighten bold text"?
^ The above comment is relevant to the LS_COLORS=''
behaviour, not so much the unset LS_COLORS
behaviour, which just uses a theme that's hard to read on a light background. We might want to pick a more neutral default theme that works on both light and dark backgrounds.
In the meantime, you can use something like vivid to generate an LS_COLORS theme that will look better with your terminal theme. For example:
@tavianator I'm using the default (MacOS, that is, BSD, I guess) ls
.
With LS_COLORS
set to the empty string, unchecking "Brighten bold text" enables fd
to render colors that are legible against the solarized light background, that is, it resolves the issue. It hadn't occurred to me that "Brighten bold text" would interfere with rendering color; what I thought (apparently incorrectly) was that brightening was independent of color.
There is still a difference in the way fd
and ls
render colors: the fd
version is bolder:
djb@koala-4 test % fd -d 1 --color=always . | xxd
00000000: 1b5b 313b 3334 6d2e 2f1b 5b30 6d1b 5b31 .[1;34m./.[0m.[1
00000010: 3b33 346d 7374 7566 661b 5b30 6d1b 5b31 ;34mstuff.[0m.[1
00000020: 3b33 346d 2f1b 5b30 6d0a ;34m/.[0m.
djb@koala-4 test % ls --color=always . | xxd
00000000: 1b5b 3334 6d73 7475 6666 1b5b 3339 3b34 .[34mstuff.[39;4
00000010: 396d 1b5b 306d 0a 9m.[0m.
This isn't a problem that necessarily requires a solution. Your description of the original issue as originating in a default behavior with unset LS_COLORS
is consistent with the behavior I saw originally. Setting LS_COLORS
to the empty string and unchecking "Brighten bold text" in the iTerm2 configuration is (now that you've explained it!) an easy fix. Thank you for your help!
@tavianator I'm using the default (MacOS, that is, BSD, I guess)
ls
.
Right, I should have guessed this from "iterm2" :)
There is still a difference in the way
fd
andls
render colors: thefd
version is bolder:
Yeah, that's expected. fd
follows GNU ls
here, which bolds most things by default.
Setting
LS_COLORS
to the empty string and unchecking "Brighten bold text" in the iTerm2 configuration is (now that you've explained it!) an easy fix. Thank you for your help!
You're welcome! :)
I'm going to leave this open because I do think we should consider changing the default color scheme to work okay with light terminal themes. @sharkdp how about ayu
? It looks good to me across a few different Konsole color schemes.
It looks good to me across a few different Konsole color schemes.
You mean.. for both dark and light background themes?
We have a similar problem in bat
where we now decided to implement a way to detect dark/light backgrounds (at least on MacOS) because there was no color scheme that was working for light and dark themes. But fd
is a bit different here, as we don't need that many colors probably.
at least on MacOS
Is there a way to do this that works on all (or most) platforms?
You mean.. for both dark and light background themes?
Yeah.
Is there a way to do this that works on all (or most) platforms?
bat
does it like this, which is macOS specific (and maybe only applies to the default terminal emulator?) https://github.com/sharkdp/bat/blob/3339eee2dc34d350f7c91b4c860084306196acf0/src/assets.rs#L402-L410
However, there are some other ways to get that information. Some terminals support a COLORFGBG
environment variable; here's a neovim example.
But the best way is probably the OSC
sequences, which are sparsely documented, but you can ask for the current background color with \033]11;?\033\
, and xterm
-compatible emulators will output something like 11;rgb:fdfd/f6f6/e3e3
(which is #FDF6E3
) or 11;rgb:0000/0000/0000
(which is #000000
of course).
The syntax comes from X11's XParseColor
. Apparently some terminals will output rgba:RRRR/GGGG/BBBB/AAAA
instead. I kinda hope there's an existing crate for this...
I kinda hope there's an existing crate for this...
Hm. Are we sure there are no downsides to this? Like some runtime penalty. Or compatibility problems where some users would see seemingly random garbage on the screen?
Well I read through the termbg implementation and it's not perfect, but conceptually it can be done without a delay and without the chance of users seeing garbage. I prototyped something but I'm not sure if I should publish it as it's own crate or contribute it to crossterm
Same kind of issue on macOS Ventura with default macOS Terminal.
Image:
The fd
8.5.3 command shows colors that are quite hard to read IMHO: directories appear light sky blue, and files appear light pale yellow.
Terminal app uses default white/light background. The ls
output looks fine, and not at all like fd
output. LS_COLORS is unset.
When I export LS_COLORS='' then fd
changes: directories appear as dark bold blue-purple, and files appear as black.
Expected: fd
to be easy to read on default current macOS default current Terminal app. Also that fd
would treat unset LS_COLORS the same as empty string LS_COLORS.
Actual: fd
output is too light/pale to be readable to me.
Would it be an option to make fd
behave per default as if it had been called with env LS_COLORS="" fd
? In my understanding this would work out of the box with all terminal colorschemes , and wouldn't require extra logic to determine if the terminal colorscheme has a light or dark background.
I also want to emphasize that this should be fixed instead of leaving it up to the user to add export LS_COLORS=''
.
It's also noteworthy that setting LS_COLORS
to ''
also makes exa
loose all colors.
So to make fd
and exa
work at the same time, you have to add this to your rc file:
export EXA_COLORS="$LS_COLORS"
export LS_COLORS=''
this is not only broken with solarized, but with gnome white background terminal as well. fd makes a difference if LS_COLORS is set to empty string, and not set.
What version of
fd
are you using? fd 8.2.1In iterm2 (Build 3.4.15)
fd
renders several colors in pale pastel hues that cannot easily be read against the background because of insufficient contrast.ls -G
does not have this issue. My iterm2 settings are:LS_COLORS is not set.
I'm not wedded to "Light (High Contrast)" or "Solarized light", but my vision is imperfect and I can't read the screen with dark themes, so I do need something light (but not a bright white background) with strong colors and strong color contrasts. I don't have this issue with any other application that produces colored text output in iterm2. Are there iterm2 settings or
fd
options that would enable me to render output fromfd
that is no less legible than the output oflg -G
?