6 Color Prefs
Registers a preference whose value will be updated when the user clicks on
one of the color scheme default settings in the preferences dialog.
Finally, it adds calls preferences:add-callback to set a callback
for pref-name that updates the style list when the preference
If white-on-black-color is not #f, then the color of the
color/sd argument is used in combination with
white-on-black-color to register this preference with
If background is not #f, then it is used to construct the
default background color for the style delta.
Calls func with the subpanel of the preferences coloring panel
that corresponds to name.
Builds a panel with a number of controls for configuring a font: its color
(including a background configuration if background
and check boxes for bold, italic, and underline. The parent
argument specifies where the panel will be placed. The pref-sym
should be a preference (suitable for use with preferences:get
). The style-name
specifies the name of a
style in the style list returned from
in the panel so users can see the results of their configuration.
Builds a printed representation for a style-delta.
Builds a style delta from its printed representation. Returns #f
if the printed form cannot be parsed.
Registers a new color or style named name for use in the color schemes.
If style is provided, a new style is registered; if not a color is
The default values of all of the keyword arguments are #f, except
bold, which defaults to 'base (if style is not #f).
Adds a panel for choosing a color-scheme to the preferences dialog.
The extras argument is called after the color schemes have been added
to the preferences panel. It is passed the panel containing the color schemes
and can add items to it.
file in each collection, looking for the key
. Each definition must bind
a list of hash tables, each of which introduces a new
color scheme. Each hash table should have keys that specify
details of the color scheme, as follows:
'name: must be either a string or a symbol;
if it is a symbol and string-constant?,
it is passed to dynamic-string-constant
to get the name; otherwise it is used as the name directly.
If absent, the name of the directory containing the "info.rkt"
file is used as the name.
'white-on-black-base?: must be a boolean indicating if this
color-scheme is based on an inverted color scheme. If absent, it
'example: must be a string and is used in the preferences dialog
to show an example of the color scheme. If absent, the string used in
the “Classic” color scheme is used.
'colors: must be a non-empty list whose first position
is a symbol, naming a color or style. The rest of the elements describe
the style or color. In either case, an element may be a vector describing
a color, see below.
If the name corresponds to a style, then the list may also contain
Symbols 'bold, 'italic,
or 'underline, changing the font style
or underline status, or
A prefab struct `#s(background ,vec),
specifying the background color where
vec is a vector describing a color.
A vector describing a color is either a vector of three bytes describing
the red, green and blue component of a non-transparent color,
or a vector of three bytes followed by a real number between
0 and 1, giving the alpha value in addition to color
components. In other words, a vector satisfying the following contract
describes a color:
| #(0 0 0))|
| #(194 116 31) italic)|
| bold underline #(255 0 0))|
| #(255 165 0)|
| #s(background #(0 0 0))))|
The names of the colors and styles are extensible; new ones can be added by calling
is called, it logs the active set of color names and style names to the color-scheme
logger at the info level. So, for example, starting up DrRacket like this:
racket -W info@color-scheme -l drracket
will print out the styles used in your
version of DrRacket.
Returns the current color scheme’s name.
if the input is a symbol?
a color or style that is part of the current color scheme.
Returns #t if name is a known color scheme name,
and is connected to a style.
Returns the current style delta or color associated with name.
Updates the current color or style delta associated with
name in the current color scheme.
If weak? is #t, the fn argument is held
onto weakly; otherwise it is held onto strongly.
Returns two sets; the first is the known color scheme names that are just colors
and the second is the known color scheme names that are styles.
These are all of the names that have been passed to color-prefs:add-color-scheme-entry.