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, but
does not give it a name that can be configured by a color scheme; consider using
color-prefs:add-color-scheme-entry instead.
This function registers a color preference but does not give it
a name that can be configured by a color scheme; consider using
color-prefs:add-color-scheme-entry instead.
This function calls preferences:set-default and
preferences:set-un/marshall to install the pref for
pref-name, using color/sd as the default color. The
preference is bound to a style-delta%, and initially the
style-delta% changes the foreground color to color/sd,
unless color/sd is a style delta already, in which case it is just
used directly. Then, it calls
editor:set-standard-style-list-delta passing the
style-name and the current value of the preference
pref-name.
Finally, it adds calls preferences:add-callback to set a callback
for pref-name that updates the style list when the preference
changes.
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
color-prefs:set-default/color-scheme.
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.
The panel is created as a vertical-panel%, passing style as the
style argument to its constructor.
Changed in version 1.61 of package gui-lib: Added the #:style argument.
Builds a panel with a number of controls for configuring a font: its color
(including a background configuration if
background is
#t)
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 and
preferences:set). The
style-name specifies the name of a
style in the style list returned from
editor:get-standard-style-list and
example-text is shown
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 not #f, a new style is registered; if not a color is
registered.
If a style is registered, the style is stored in the style list
returned from editor:get-standard-style-list.
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.
Reads
the
"info.rkt" file in each collection, looking for the key
'framework:color-schemes. 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;
it names the entire color scheme.
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
is #f.
'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 entry in the color scheme.
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:
Examples:
'((framework:syntax-color:scheme:symbol |
#(0 0 0)) |
(framework:syntax-color:scheme:comment |
#(194 116 31) italic) |
(framework:syntax-color:scheme:error |
bold underline #(255 0 0)) |
(plt:htdp:test-coverage-off |
#(255 165 0) |
#s(background #(0 0 0)))) |
The names of the colors and styles are extensible; new ones can be added by calling
color-prefs:add-color-scheme-entry. When
color-prefs:register-info-based-color-schemes
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.
Sets
the current color scheme to the scheme named name,
if name is one of the color schemes.
Otherwise, sets the color scheme to the default color scheme.
Returns the current color scheme’s name.
Returns
#t if the input is a
symbol? that names
a color or style that is an entry in the current color scheme.
Returns #t if name is a known color scheme name,
and is connected to a style.
Returns #t if name is a known color scheme name,
and is connected to a color.
In order to return
#t,
name must have been
passed as the first argument to
color-prefs:add-color-scheme-entry
and the
#:style argument must have also been omitted or be
#f.
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.