How to resolve the algorithm Terminal control/Coloured text step by step in the Common Lisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Terminal control/Coloured text step by step in the Common Lisp programming language

Table of Contents

Problem Statement

Display a word in various colours on the terminal. The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.

Optionally demonstrate:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Terminal control/Coloured text step by step in the Common Lisp programming language

Source code in the common programming language

(defun coloured-text ()
  (with-screen (scr :input-blocking t :input-echoing nil :cursor-visible nil)
    (dolist (i '(:red :green :yellow :blue :magenta :cyan :white))
      (add-string scr (format nil "~A~%" i) :fgcolor i))
      (refresh scr)
      ;; wait for keypress
      (get-char scr)))


  

You may also check:How to resolve the algorithm Copy stdin to stdout step by step in the Latitude programming language
You may also check:How to resolve the algorithm Terminal control/Coloured text step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm String prepend step by step in the NewLISP programming language
You may also check:How to resolve the algorithm Hello world/Graphical step by step in the HicEst programming language
You may also check:How to resolve the algorithm 100 prisoners step by step in the REXX programming language