Loading ...
Sorry, an error occurred while loading the content.
 

Re: Inverse and bold text in command line version

Expand Messages
  • marionbarryuk
    Thanks, that is what I was looking for!
    Message 1 of 8 , Nov 13, 2012
      Thanks, that is what I was looking for!

      --- In chipmunkbasicforum@yahoogroups.com, "Larr" <larrh@...> wrote:
      >
      > I used to do this stuff all the time when I was MUCH YOUNGER (I'm now almost 50):
      >
      > Unfortunately, this sort of thing usually required knowledge of the terminal type that is being used.
      >
      > $ echo $TERM
      > xterm-256color
      >
      > Here's the COMMAND LINE equivalent of what you're looking for:
      >
      > $ echo -e "\033[1mThis is a BOLD line\033[0m"
      >
      > MOST terminals observe the same sequence tho:
      >
      > Bold: <esc>[1m
      > Plain: <esc>[0m
      >
      > Check out this URL for more escape sequences:
      >
      > http://www.isthe.com/chongo/tech/comp/ansi_escapes.html
      >
      > Replace Spaces with DOTS/PERIODS:
      >
      > www isthe com/chongo/tech/comp/ansi_escapes html
      >
      > Again, these sequences MAY or MAY NOT be 100% compatible with the terminal type in use.
      >
      > I _USED_ to have a 'screen generator' that you would feed a screen file too and it would paint the screen with protected labels. The BASIC program would call it the screen generator to paint the labels and then would perform input/positioning/etc... eventually clearing the protected values when done gathering input values.
      >
      > Larr.
      >
      > --- In chipmunkbasicforum@yahoogroups.com, marionbarryuk <no_reply@> wrote:
      > >
      > > I'd like to use bold and inverse text in an OS X command line app I am working on, but I have not been able to find the control code to do as such.
      > >
      > > Any hints?
      > >
      > > Thanks!
      > >
      > > Pete
      > >
      >
    • Larr
      And here s a bit of fun for you too (sets your command prompt - best viewed on a Black Terminal background) PS1= n [ e[0;36m ] h [ e[1;37m ] ::
      Message 2 of 8 , Nov 15, 2012
        And here's a bit of fun for you too (sets your command prompt - best viewed on a Black Terminal background)

        PS1='\n\[\e[0;36m\]\h \[\e[1;37m\] :: ${PWD}\n\u\[\e[1;34m\]`r=$?; test $r -ne 0 && echo " \[\e[1;31m\]ret:$r"`\[\e[m\] > '; export PS1

        Here's what it does:
        \n (CRLF)
        <esc>[0;36m sets the color of the text to a shade of blue
        \h (Hostname)
        <esc>[1;37m sets color of text to bold white
        :: (just two colons)
        ${PWD} is the common working directory. You can also use \w but I like to see the full path and not things like "~" for $HOME
        \n (CRLF)
        \n (Username)
        The code between the `r= ... ]ret:$r` does is check $? for 0. If non-zero display it in bold-red

        Check out this web site for a good list of color code:

        http://www.pixelbeat.org/docs/terminal_colours/

        --- In chipmunkbasicforum@yahoogroups.com, marionbarryuk <no_reply@...> wrote:
        >
        > I'd like to use bold and inverse text in an OS X command line app I am working on, but I have not been able to find the control code to do as such.
        >
        > Any hints?
        >
        > Thanks!
        >
        > Pete
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.