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
      > >
      >
    • jewisonc
      I think what he is referring to is shown in the small example program below Now in-order for this to work you need a Mac Teminal console app that can display
      Message 2 of 8 , Nov 14, 2012
        I think what he is referring to is shown in the small example program below
        Now in-order for this to work you need a Mac Teminal console app that can display ansii colour codes.

        Look in the App store for Cathode an interesting app that will take many of you far back in time.

        1 cls
        2 'Display Message In reverse Red
        10 print att$("7","31","40")+"Message"
        12 ' Reset Attributes to Green on Black background
        20 print att$("0","32","40")
        999 stop

        1000 'at$ 0=off,1=Bold,2=Low Intensity,4=underline,5=blink,7=Reverse
        1001 'Foreground Colour
        1002 'fg$ 30=black,31=red,32=Green,33=yellow,34=Blue,35=Magenta,36=Cyan,37=White
        1003 'Background Colour
        1004 'bg$ 30=black,31=red,32=Green,33=yellow,34=Blue,35=Magenta,36=Cyan,37=White
        1005 'Escape sequence used esc[mode;foreground code;background codem
        1006 'Note the 'm" character is required at the end of the string
        2000 sub att$ (at$,fg$,bg$)
        2020 att$ = chr$(27)+"["+at$+";"+fg$+";"+bg$+"m"
        2030 end sub
        2035'
        2036'Source for Ascii Info
        2037'http://ascii-table.com/ansi-escape-sequences.php

        --- 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
        > >
        >
      • jewisonc
        In previous my message Line 1004 should read as below, it won t stop the program from working it just corrects the comment. 1004 bg$
        Message 3 of 8 , Nov 14, 2012
          In previous my message Line 1004 should read as below, it won't stop the program from working it just corrects the comment.
          1004 'bg$ 40=black,41=red,42=Green,43=yellow,44=Blue,45=Magenta,46=Cyan,47=White

          --- 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 4 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.