(color-prefs:register-color-preference pref-name style-name color/sd [ white-on-black-color #:background background]) → void? pref-name : symbol? style-name : string? color/sd : (or/c (is-a?/c color%) (is-a?/c style-delta%)) white-on-black-color : (or/c string? (is-a?/c color%) #f) = #f background : (or/c (is-a?/c color%) #f) = #f
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.
(color-prefs:add-to-preferences-panel name func [ #:style style]) → void? name : string? func : (-> (is-a?/c vertical-panel%) void?)
(listof (or/c 'border 'hscroll 'auto-hscroll 'hide-hscroll 'vscroll 'auto-vscroll 'hide-vscroll)) = '()
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.
(color-prefs:build-color-selection-panel parent pref-sym style-name example-text [ #:background? background?]) → void? parent : (is-a?/c area-container<%>) pref-sym : symbol? style-name : string? example-text : string? background? : boolean? = #f
style-delta : (is-a?/c style-delta%)
→ (or/c false/c (is-a?/c style-delta%)) marshalled-style-delta : printable/c
(color-prefs:add-color-scheme-entry name black-on-white-color white-on-black-color [ #:style style #:bold? bold #:underline? underline? #:italic? italic? #:background background]) → void? name : symbol? black-on-white-color : (or/c string? (is-a?/c color%)) white-on-black-color : (or/c string? (is-a?/c color%)) style : (or/c #f string?) = #f bold : (if style (or/c boolean? 'base) #f) = #f underline? : (if style boolean? #f) = #f italic? : (if style boolean? #f) = #f
(if style (or/c #f string? (is-a?/c color%)) #f) = #f
If a style is registered, the style is stored in the style list returned from editor:get-standard-style-list.
'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.
'inverted-base-name: must be a symbol or #f. If it is a symbol, the symbol indicates the name of a color scheme that corresponds to the present scheme, but in the inverted color mode. If absent, it defaults to #f. When a color scheme has an inverted color scheme named, that color scheme must have the opposite boolean in its 'white-on-black-base? field and, under Mac OS, switching to and from dark mode will switch between the two color schemes. Note that both schemes must name the opposite mode color scheme.
'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:
(or/c (vector/c byte? byte? byte? #:flat? #t) (vector/c byte? byte? byte? (between/c 0.0 1.0) #:flat? #t))
'((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.
Changed in version 1.68 of package gui-lib: Added 'inverted-base-name.
Added in version 1.68 of package gui-lib.
(if (color-prefs:color-scheme-style-name? name) (is-a?/c style-delta%) (is-a?/c color%)) name : color-prefs:known-color-scheme-name?
(color-prefs:set-in-color-scheme name new-val) → void? name : color-prefs:known-color-scheme-name?
(if (color-prefs:color-scheme-style-name? name) (is-a?/c style-delta%) (is-a?/c color%))
(color-prefs:register-color-scheme-entry-change-callback name fn [ weak? #:style-list style-list]) → void? name : color-prefs:known-color-scheme-name?
(if weak? (procedure-arity-includes/c 1) (-> (if (color-prefs:color-scheme-style-name? name) (is-a?/c style-delta%) (is-a?/c color%)) any)) weak? : boolean? = #f style-list : (or/c #f (is-a?/c style-list%)) = #f
If weak? is #t, the fn argument is held onto weakly; otherwise it is held onto strongly.
Changed in version 1.68 of package gui-lib: added the style-list argument
These are all of the names that have been passed to color-prefs:add-color-scheme-entry.