  Colours with Linux terminals

  :Thorbjn Ravn Andersen, ravn@dit.ou.dk <mailto: ravn@dit.ou.dk>
  ۼ(): 1996 04 27 16 56 15
  :Suck Joong.Hwang - Ȳ   whitehsj@nownuri.net <mailto:
  whitehsj@nownuri.net>
  ______________________________________________________________________

  

  1.  
  2. ls    ϴ°?
  3. ls   ϴ°?
  4. ׿   ϴ°?
     4.1 Xterm
     4.2  ܼ
        4.2.1 /etc/issue
        4.2.2 /etc/profile ̳ .profile 
     4.3  ӽ

  5. Ʈ

  ______________________________________________________________________

  1.   

  κ   ÷ ϴ ls ϰ ֽϴ.
  ̻ ó   , װ ׸  ƴϾ
  Դϴ. ׷   ÷ ls   ͹̳ο
     ٷ ϴ. ̹ HTML(
  ƴ:) <www.dit.ou.dk/~ravn/colour-ls
  <http://www.dit.ou.dk/~ravn/colour-ls>>            ֽϴ.

     2.0.2 ϵ Ŀ 1.1.54 Ŀ κ
    2.2.0 Ŀ 1.2.13 Ͽ, δ ǥؽ tcsh
    Ͽϴ.

  2.  ls    ϴ°?

    ũƮ( bash ֽ в  帳ϴ.)
   ǥ  մϴ.  ƹ  Ÿ ʴ ٸ
   ܼ(= ͹̳:) ANSI  ϱ  ̴ϴ.

  ______________________________________________________________________
         #!/bin/bash
         # Ƚ ÷ !
         #
         esc="\033["
         echo -e "\t  40\t   41\t   42\t    43\t      44       45\t46\t 47"
         for fore in 30 31 32 33 34 35 36 37; do
           line1="$fore  "
           line2="    "
           for back in 40 41 42 43 44 45 46 47; do
             line1="${line1}${esc}${back};${fore}m   ${esc}0m"
             line2="${line2}${esc}${back};${fore};1m     ${esc}0m"
           #  : ^[[30;30m .or. ^[[30;30;1m  <-- 
           done
           echo -e "$line1\n$line2"
         done
  ______________________________________________________________________

   : ڰ    esc="\033["̶ Ÿ Դϴ.
   ̰ ƴϰ "^[["Դϴ.  Ʋ Ÿ  Ȯ
  𸣰 ٸ  ý 鼭   ˴ϴ.
  ԷҶ "^[[" ׳ Էϴ  ƴ϶ "Ʈ-v-ESCŰ-["Դ
  .    Ŀǵ峪 vi Ϳ  ̰ ̸ƽ "C-q
  -ESCŰ-["Դϴ.  ϼ. :)

  ______________________________________________________________________
      (ڻ) δ Ʈ  Ÿ,   ⿡ 
     Ÿ ϴ.(Ѹ ǥԴϴ:)   ϽŴٸ ANSIĶ
      ";1m" ġ ˴ϴ.  ANSI   ϴ.

      ESC[30;40;1m     <- ESC[  ^[[ մϴ. ̽ Դϴ.: 

  ______________________________________________________________________

  : μ    ̿  ϴ, ׷
  (  )    ϴ. ϵ ѰԴϴ.
  (Xterm ʹ ټ ̰ ֽϴ:)

  3.  ls   ϴ°?

  Ϲ     'LS_COLORS' ȯ溯
  մ .

  $HOME/.dir_colors Ϲ    ̴ϴ.
  LS_COLORS=:no=00:fi=00:di=01:ln=01;36:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:..

  ǥ ġ ٸ ϰ ôٸ,  (
  ANSIԴϴ: ) Ѵ eval 'dircolors -t'  ġ
  ȯ溯 մϴ.

  : Ȥ  2.2  ִ ls ̿Ͻð ִٸ
  ׷ ̵带 մϴ.   װ ϴ.

  4.  ׿   ϴ°?

   ͹̳  Ǵٸ  ⺻ ġ ôٸ
  ͹̳ ̹ ڵ带 Ұ  ˾ƾ մϴ.  
  ǥ   ʽϴ.    'setterm'̶
  α׷ ־   ص ˴ϴ.    
  մϴ.

     setterm -foreground black -background white -store
                          

  ⼭ -store Ķʹ ܼ ⺻  ׷
  ̿Ѵٰ set term ˸ Դϴ. ׷ setterm ˾Ƽ
   ͹̳οԼ   ˾ ϴ.(TERMCAP̶
  ȯ溯 ϴ Դϴ).   ڴٸ, ϰ 
  ־ ?(exportϰ TERMCAP̶ ȯ  ø ذ
  ǰ̴ϴ.:)

  4.1.  Xterm

    մϴ.

  xterm -fg white -bg blue4 color_xterm -fg white -bg blue4 ⼭
  'color_xterm' ÷ ls ϴ xterm Դϴ.

  4.2.   ܼ

  ڵ߿ ѹ Ŀ غ  ִ е  Դϴ.
   ܼ  ⺻ ANSI ̽ ڸ ϴ 
  ,   ڰ ѹ Ŀ  غź̶
  Ŀμ ϰ(Ƿ ?  )մϴ.

     /usr/src/linux/drivers/char/console.c  1800 Դϴ. ̺κ 
     ϼž մϴ.
                  def_color      = 0x07;      /* white */
                  ulcolor        = 0x0f;      /* bold white*/
                  halfcolor      = 0x08;      /* grey */
      ̷ ó.
                  def_color      = 0x17;      /* white */
                  ulcolor        = 0x1f;      /* bold white 7+8*/
                  halfcolor      = 0x18;      /* grey */

      16  ī尡 ̿ϴ Ӽ ڵԴϴ. ù° ʵ("1"ڰ ִ
     ڸ) ̰ ׵ ʵ Դϴ. ȣ
                    0       û    1          2
                  ûϻ  3         4       ֻ 5
                  /  6                     7

  Դϴ.   8 ϸ   ˴ϴ.   8
    ̴ ڰ ǰų, 帰  ˴ϴ.
  (sjlam1@mda023.cc.monash.edu.au <mailto:
  sjlam1@mda023.cc.monash.edu.au>  ).

    ܼ ο ⺻ ϰ ɰԴϴ.
  ÷̸  ǥ Ƚø ⺻ ؼ Դϴ.(Ŀ ҽ
  ãƺ.)  ESC [ 8 ]  Ƚùڸ   -
  ⺻ ϰ ˴ϴ. ESC  Ӽ ȯĿ ϸ
   /  ϰ    ϰ ˴ϴ.
  Ҷ ż ̹ڵ ̿ϸ ְ?

  4.2.1.  /etc/issue

  ý ڸ йȣ Է¹   "Welcome to Linux
  xx.yy"     ̴ϴ. ٷ   ϴ
  Դϴ.  /etc/rc.d/rc.S  ũƮ ý  ϰ
  ˴ϴ. ׷ϱ   ؾ մϴ.  75  ̷
    ̴ϴ.

  echo ""> /etc/issue    #/etc/issue    Դϴ.  echo
  Welocome to Linux '/bin/uname -a | /bin/cut -d\ -f3'. >> /etc/issue #
  -----------------> ̹ Ŀ  ó issue ֽϴ.

    ̷ ħϴ.  ESCAPE="" echo
  "${ESCAPE}[H${ESCAPE}[37;44m${ESCAPE}[8]${ESCAPE}[2J"> /etc/issue
  ̷ ġ̴ٸ  ϼ. ׷ ⺻͹̳ 
  (/û)  ȭ  ȭä   Դϴ.
  "^[" ԷҶ    ϴ ƽð? ϼ.

  4.2.2.  /etc/profile ̳ .profile 

   :  /etc/profile ̳ .profile bash,tcsh 
  ⵿ɶ  ϴ ġԴϴ.

  if ( "$TERM" == "console" ) then echo "[37;44m[8]" #̷ ϰų
  Ʒ  ϼ.  setterm -foreground white -background blue -store
  endif

  4.3.   ӽ

   ٿ  setterm  ̿ ˾ƾ մϴ.  ӽ
  ݸӽ   ͹̳ο   䱸 Դϴ. ׸ 
  ͹̳ ķ ʹ ÷ α() Ұ ɰԴϴ.  
  ̰Ϳ  ʸ ϰ Ǹ  ˷ ֽø ϰڽϴ

  5.  Ʈ

    ٷ    ġߴٴ Ͽ
  ϴ.  ڰ ׿ ٸ (e.g. a Sun running X) 
  ִٸ  ؼ   ؾ  𸨴ϴ.  ÷ xterm 
  ǥ xtermҽ ġ Բ ⺻ X11R6 site ֽ .
  ftp.denet.dk/pub/X11/contrib/utilities/color-xterm-R6p15-pacth.gz
  <ftp://ftp.denet.dk/pub/X11/contrib/utilities/color-xterm-
  R6p15-pacth.gz>

   X ý ϰ ôٸ ù о ž
  ҰԴ . :  õغ ʾҽϴ.  ÷ ls  ̷
  Ʈ Ҽ ֽϴ.

  ftp.denet.dk/pub/gnu/fileutils-3.12.tar.gz
  <ftp://ftp.denet.dk/pub/gnu/fileutils-3.12.tar.gz>

  ftp.funet.fi/pub/Linux/sunsite/utils/file/color-ls-3.12.0.3.patch.gz <
  ftp://ftp.funet.fi/pub/Linux/sunsite/utils/file/color-
  ls-3.12.0.3.patch.gz>

   color-ls ҽ ֶ󸮽,SunOS,Irix 
  ߽ϴ.   ġ ֽŹ ҽ 䱸ϴ ҽ 
  Ǿٸ  ġ  Դϴ.     ǰ
  ֽø ϰڽϴ.  E-mail ּҴ <ravn@dit.ou.dk <mailto:
  ravn@dit.ou.dk>> Դϴ.

