froggey / Mezzano

An operating system written in Common Lisp
MIT License
3.52k stars 188 forks source link

The transparent editor windows are just about unusable! #196

Closed j3pic closed 1 year ago

j3pic commented 1 year ago

It's beyond irritating to attempt to read code in a transparent window, whether the thing behind the window is the background image, or other windows full of text. After a little reverse-engineering, I found that the transparency is part of the background color, defined in mezzano.gui.theme:*background*. Nowhere do I find this documented.

The color is bit packed, and it took additional reverse engineering to figure out how to pack the bits. For anyone else having this problem, the following two functions can be used to set the background color to something that isn't transparent:

(defun make-color (&key (r 0) (g 0) (b 0) (a 255))
  "Given values for R (red), G (green), B (blue), and A (Alpha) from 0 to 255, create a Mezzano color."
  (logior (ash a 24)
          (ash r 16)
          (ash g 8)
          b))

(defun set-background (&optional (color (make-color)))
  "Sets the background color used by the MED editor and the REPL and debugger windows. Called with no arguments, it
sets the background to fully-opaque black."
  (setf mezzano.gui.theme:*background* color))
froggey commented 1 year ago

The windows are semi-transparent by default because it looks cool. As you found out, it's not particularly difficult to change the default background colour.

If you want to seriously read the code I would suggest checking it out and using the editor of your choice, along with building the system yourself, which would give you access via slime/swank in emacs including jump-to-location.

For more details about colours, including make-colour-from-octets and the bit layout definitions, take a look in gui/colour.lisp.