module BBS::Petscii::Colors
The colours of a line-by-line C64 board as two-letter constants: the C64 names of the BBS::Ansi palette, so each is an ANSI SGR sequence. A PETSCII session (session.petscii!) turns them into the C64βs own colour codes, and the width helpers of rubbs (BBS::FrameBuffer) know ANSI, where they would count PETSCII codes as text. The same sequences show on a modern terminal too.
A class gets the bare names by including the module (BBS::Petscii::Screen does, so its subclasses have them). A boardβs namespace module needs ::install, because Ruby looks a bare constant up in the modules the code is lexically nested in, not in what they include:
module UI module Petscii BBS::Petscii::Colors.install(self) class Board # nested: WH, LG, RV β¦ work here def head = "#{WH}hello#{LG}" end end end
Constants
- BL
-
Blue.
- CY
-
Cyan.
- DG
-
Dark grey.
- GN
-
Light green.
- GR
-
Medium grey.
- LB
-
Light blue.
- LG
-
Light grey, the colour of plain text.
- OR
-
Orange.
- PU
-
Purple.
- RD
-
Light red.
- RO
-
Reverse video off.
- RV
-
Reverse video on.
- WH
-
White (the C64βs white).
- YE
-
Yellow.
Public Class Methods
Source
# File lib/bbs/petscii/colors.rb, line 62 def self.install(mod) constants.each do |name| mod.const_set(name, const_get(name)) unless mod.const_defined?(name, false) end mod end