Absoft User Forum

Support => Macintosh => Topic started by: jonnygto on June 21, 2012, 03:38:19 PM

Title: ? how to add highlighting or color to Mac Terminal output
Post by: jonnygto on June 21, 2012, 03:38:19 PM
Does anyone know of a Fortran way to add highlights or color to Mac Terminal output text,
maybe with Write statement control codes of some kind, or system calls?
Title: Re: ? how to add highlighting or color to Mac Terminal output
Post by: forumadmin on June 25, 2012, 08:05:15 AM
You can do it with ANSI escape codes in WRITE statements. Using Google or an equivalent, search for a string something like:

os x terminal ansi codes

Here's a simple example:

        character(len=1), parameter :: esc=char(27)
        print *,'Hello'
        print *,esc,'[','45m','Hello',esc,'[0m'
        print *,'Hello'
        end
Title: Re: ? how to add highlighting or color to Mac Terminal output
Post by: jonnygto on July 09, 2012, 06:03:40 PM
Thank you for the reply. It helps a lot.