[gambit-list] Changing Console (Terminal) Colours

Marc Feeley feeley at iro.umontreal.ca
Tue Mar 18 14:58:36 EDT 2014


On Mar 18, 2014, at 7:41 AM, Edwin Blake <edwin at cs.uct.ac.za> wrote:

> I am using the Gambit-C Interpreter on Windows 7.
> 
> The terminal window comes up with grey text on a black background. When 
> I change the colours in the window title bar options they revert back to 
> the white on black for all entered text and responses.  This is 
> different from the behaviour of the standard windows terminal.
> 
> I cannot see any options to change this behaviour so any help will be 
> appreciated.  The current choices do not project well even with large 
> fonts and bold text.
> 
> thanks
> 
> edwin

There’s a function to change the attributes of the console's input text (entered by the user) and the output text:

(tty-text-attributes-set! (repl-output-port) #x088 #x088)

Where the two numbers encode the color of the input and output respecively.  Here’s the encoding:

       (define style-normal    0)
       (define style-bold      1)
       (define style-underline 2)
       (define style-reverse   4)

       (define color-black   0)
       (define color-red     1)
       (define color-green   2)
       (define color-yellow  3)
       (define color-blue    4)
       (define color-magenta 5)
       (define color-cyan    6)
       (define color-white   7)
       (define default-color 8)

       (define (make-text-attr style fg bg)
         (+ (* style 256) fg (* bg 16)))

Unfortunately I think this functionality is broken on Windows.  I’ll push a fix soon.

Marc




More information about the Gambit-list mailing list