tree(1) colours not properly interpeted by watch(1) even with --color option

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I am using a simple combination of commands to "monitor" a bit of my filesystem change: watch and tree.

Except I want colours and can't get it.



Here's what I thought should work: watch --color 'tree -C' which kind of works since it gives me some colours, but not in the same way as tree -C by itself.



Here's some screencaps:
watch --color 'tree -C' output, with some colours applying
watch 'tree -C' output, showing that tree does indeed send all escape codes
tree -C output, expected result



Culprit might also be in my env variables, but if I watch 'echo $LS_COLORS', my conf is there.



Any ideas? :)










share|improve this question

























    up vote
    1
    down vote

    favorite












    I am using a simple combination of commands to "monitor" a bit of my filesystem change: watch and tree.

    Except I want colours and can't get it.



    Here's what I thought should work: watch --color 'tree -C' which kind of works since it gives me some colours, but not in the same way as tree -C by itself.



    Here's some screencaps:
    watch --color 'tree -C' output, with some colours applying
    watch 'tree -C' output, showing that tree does indeed send all escape codes
    tree -C output, expected result



    Culprit might also be in my env variables, but if I watch 'echo $LS_COLORS', my conf is there.



    Any ideas? :)










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am using a simple combination of commands to "monitor" a bit of my filesystem change: watch and tree.

      Except I want colours and can't get it.



      Here's what I thought should work: watch --color 'tree -C' which kind of works since it gives me some colours, but not in the same way as tree -C by itself.



      Here's some screencaps:
      watch --color 'tree -C' output, with some colours applying
      watch 'tree -C' output, showing that tree does indeed send all escape codes
      tree -C output, expected result



      Culprit might also be in my env variables, but if I watch 'echo $LS_COLORS', my conf is there.



      Any ideas? :)










      share|improve this question













      I am using a simple combination of commands to "monitor" a bit of my filesystem change: watch and tree.

      Except I want colours and can't get it.



      Here's what I thought should work: watch --color 'tree -C' which kind of works since it gives me some colours, but not in the same way as tree -C by itself.



      Here's some screencaps:
      watch --color 'tree -C' output, with some colours applying
      watch 'tree -C' output, showing that tree does indeed send all escape codes
      tree -C output, expected result



      Culprit might also be in my env variables, but if I watch 'echo $LS_COLORS', my conf is there.



      Any ideas? :)







      colors watch tree






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 13 at 19:49









      Inva

      82




      82




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          The basic problem is that watch and tree use different information for getting the colors:



          • The watch program interprets standard (ECMA-48) escape sequences for specifying video attributes. That means 8 colors, plus bold, blink, underline, reverse and italics. It uses (n)curses to display the information, making the result depend on the terminal database


          • The tree program mimics GNU ls, using the LS_COLORS environment variable. That uses the TERM environment variable (which curses and most other terminal applications use to identify an entry in the terminal database) to select a set of customized escape sequences, which do not necessarily have any relationship to the terminal database's descriptions.


          With some work, you could make those match, e.g., by generating a suitable LS_COLORS for a given terminal entry. Apparently no one has done that. And since the contents of LS_COLORS incomplete (covering only a small fraction of a terminal description: no function keys, no cursor movement, no generality), there is no point in generating a terminal entry from LS_COLORS.



          If tree uses 256 colors, watch may not understand those codes (a recent change addresses a part of this issue for procps top but has not been adapted for watch — wait a while). watch uses (n)curses to manage the screen, which makes it necessary (for watch) to translate escape-codes into curses-calls.



          Further reading:



          • How do I get color with VT100?


          • Applications miscited as library users

          • The Tree Command for Linux Homepage

          • procps (watch development)





          share|improve this answer






















          • Makes sense! Thanks for the readings :)
            – Inva
            Sep 13 at 22:53











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f468885%2ftree1-colours-not-properly-interpeted-by-watch1-even-with-color-option%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          The basic problem is that watch and tree use different information for getting the colors:



          • The watch program interprets standard (ECMA-48) escape sequences for specifying video attributes. That means 8 colors, plus bold, blink, underline, reverse and italics. It uses (n)curses to display the information, making the result depend on the terminal database


          • The tree program mimics GNU ls, using the LS_COLORS environment variable. That uses the TERM environment variable (which curses and most other terminal applications use to identify an entry in the terminal database) to select a set of customized escape sequences, which do not necessarily have any relationship to the terminal database's descriptions.


          With some work, you could make those match, e.g., by generating a suitable LS_COLORS for a given terminal entry. Apparently no one has done that. And since the contents of LS_COLORS incomplete (covering only a small fraction of a terminal description: no function keys, no cursor movement, no generality), there is no point in generating a terminal entry from LS_COLORS.



          If tree uses 256 colors, watch may not understand those codes (a recent change addresses a part of this issue for procps top but has not been adapted for watch — wait a while). watch uses (n)curses to manage the screen, which makes it necessary (for watch) to translate escape-codes into curses-calls.



          Further reading:



          • How do I get color with VT100?


          • Applications miscited as library users

          • The Tree Command for Linux Homepage

          • procps (watch development)





          share|improve this answer






















          • Makes sense! Thanks for the readings :)
            – Inva
            Sep 13 at 22:53















          up vote
          0
          down vote



          accepted










          The basic problem is that watch and tree use different information for getting the colors:



          • The watch program interprets standard (ECMA-48) escape sequences for specifying video attributes. That means 8 colors, plus bold, blink, underline, reverse and italics. It uses (n)curses to display the information, making the result depend on the terminal database


          • The tree program mimics GNU ls, using the LS_COLORS environment variable. That uses the TERM environment variable (which curses and most other terminal applications use to identify an entry in the terminal database) to select a set of customized escape sequences, which do not necessarily have any relationship to the terminal database's descriptions.


          With some work, you could make those match, e.g., by generating a suitable LS_COLORS for a given terminal entry. Apparently no one has done that. And since the contents of LS_COLORS incomplete (covering only a small fraction of a terminal description: no function keys, no cursor movement, no generality), there is no point in generating a terminal entry from LS_COLORS.



          If tree uses 256 colors, watch may not understand those codes (a recent change addresses a part of this issue for procps top but has not been adapted for watch — wait a while). watch uses (n)curses to manage the screen, which makes it necessary (for watch) to translate escape-codes into curses-calls.



          Further reading:



          • How do I get color with VT100?


          • Applications miscited as library users

          • The Tree Command for Linux Homepage

          • procps (watch development)





          share|improve this answer






















          • Makes sense! Thanks for the readings :)
            – Inva
            Sep 13 at 22:53













          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          The basic problem is that watch and tree use different information for getting the colors:



          • The watch program interprets standard (ECMA-48) escape sequences for specifying video attributes. That means 8 colors, plus bold, blink, underline, reverse and italics. It uses (n)curses to display the information, making the result depend on the terminal database


          • The tree program mimics GNU ls, using the LS_COLORS environment variable. That uses the TERM environment variable (which curses and most other terminal applications use to identify an entry in the terminal database) to select a set of customized escape sequences, which do not necessarily have any relationship to the terminal database's descriptions.


          With some work, you could make those match, e.g., by generating a suitable LS_COLORS for a given terminal entry. Apparently no one has done that. And since the contents of LS_COLORS incomplete (covering only a small fraction of a terminal description: no function keys, no cursor movement, no generality), there is no point in generating a terminal entry from LS_COLORS.



          If tree uses 256 colors, watch may not understand those codes (a recent change addresses a part of this issue for procps top but has not been adapted for watch — wait a while). watch uses (n)curses to manage the screen, which makes it necessary (for watch) to translate escape-codes into curses-calls.



          Further reading:



          • How do I get color with VT100?


          • Applications miscited as library users

          • The Tree Command for Linux Homepage

          • procps (watch development)





          share|improve this answer














          The basic problem is that watch and tree use different information for getting the colors:



          • The watch program interprets standard (ECMA-48) escape sequences for specifying video attributes. That means 8 colors, plus bold, blink, underline, reverse and italics. It uses (n)curses to display the information, making the result depend on the terminal database


          • The tree program mimics GNU ls, using the LS_COLORS environment variable. That uses the TERM environment variable (which curses and most other terminal applications use to identify an entry in the terminal database) to select a set of customized escape sequences, which do not necessarily have any relationship to the terminal database's descriptions.


          With some work, you could make those match, e.g., by generating a suitable LS_COLORS for a given terminal entry. Apparently no one has done that. And since the contents of LS_COLORS incomplete (covering only a small fraction of a terminal description: no function keys, no cursor movement, no generality), there is no point in generating a terminal entry from LS_COLORS.



          If tree uses 256 colors, watch may not understand those codes (a recent change addresses a part of this issue for procps top but has not been adapted for watch — wait a while). watch uses (n)curses to manage the screen, which makes it necessary (for watch) to translate escape-codes into curses-calls.



          Further reading:



          • How do I get color with VT100?


          • Applications miscited as library users

          • The Tree Command for Linux Homepage

          • procps (watch development)






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 13 at 21:14

























          answered Sep 13 at 20:53









          Thomas Dickey

          50.3k587157




          50.3k587157











          • Makes sense! Thanks for the readings :)
            – Inva
            Sep 13 at 22:53

















          • Makes sense! Thanks for the readings :)
            – Inva
            Sep 13 at 22:53
















          Makes sense! Thanks for the readings :)
          – Inva
          Sep 13 at 22:53





          Makes sense! Thanks for the readings :)
          – Inva
          Sep 13 at 22:53


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f468885%2ftree1-colours-not-properly-interpeted-by-watch1-even-with-color-option%23new-answer', 'question_page');

          );

          Post as a guest













































































          Il AMEwBB7A6,c5cZs94 seXhu0O1m0XkIK7,bJNHNRek Cqs EcA2nv01
          sIIEBljTAOh8,FdXsh Xk3Z 3LDpXm 5yKw5XOg5qZ0lhWpK2,pdFfISAYZ0XZ84SC2Q6iR3B,b7qBMw

          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          How many registers does an x86_64 CPU actually have?

          Displaying single band from multi-band raster using QGIS