▼ |  | Framework: Racket GUI Application Framework

1 | Application
2 | Autosave
3 | Canvas
4 | Color Model
5 | Color Prefs
6 | Color
7 | Comment Box
8 | Editor Snip
9 | Editor
10 | Exit
11 | Finder
12 | Frame
13 | Group
14 | GUI Utilities
15 | Handler
16 | Icon
17 | Keymap
18 | Menu
19 | Mode
20 | Number Snip
21 | Panel
22 | Pasteboard
23 | Path Utils
24 | Preferences
25 | Preferences, Textual
26 | Racket
27 | Text
28 | Splash
29 | Test
30 | Version
| Index

On this page:

color-prefs: set-default/ color-scheme
color-prefs: register-color-preference
color-prefs: add-background-preferences-panel
color-prefs: add-to-preferences-panel
color-prefs: build-color-selection-panel
color-prefs: marshall-style-delta
color-prefs: unmarshall-style-delta
color-prefs: white-on-black
color-prefs: black-on-white

top ← prev up next →

### 5`` Color Prefs

( color-prefs:set-default/color-scheme |  | pref-sym |
|  | black-on-white-color |
|  | white-on-black-color) |

→ void?
pref-sym : symbol?
black-on-white-color : ( or/c ( is-a?/c color% ) string? )
white-on-black-color : ( or/c ( is-a?/c color% ) string? )

Registers a preference whose value will be updated when the user clicks on one of the color scheme default settings in the preferences dialog.

Also calls preferences:set-default and preferences:set-un/marshall with appropriate arguments to register the preference.

( color-prefs:register-color-preference |  | pref-name |
|  | style-name |
|  | color/sd |
| [ | white-on-black-color]) |

→ 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% ) false/c )
|  |  | = |  | #f

This function registers a color preference and initializes the style list returned from editor:get-standard-style-list. In particular, it 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-background-preferences-panel ) → void?

Adds a preferences panel that configures the background color for editor:basic-mixin.

( color-prefs:add-to-preferences-panel |  | name |  |  |  |
|  | func) |  | → |  | void?

name : string?
func : (( is-a?/c vertical-panel% ) . -> . void? )

Calls func with the subpanel of the preferences coloring panel that corresponds to name.

( color-prefs:build-color-selection-panel |  | parent |  |  |  |
|  | pref-sym |  |  |  |
|  | style-name |  |  |  |
|  | example-text) |  | → |  | void?

parent : ( is-a?/c area-container<%> )
pref-sym : symbol?
style-name : string?
example-text : string?

Builds a panel with a number of controls for configuring a font: the color 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.

( color-prefs:marshall-style-delta style-delta) → printable/c
style-delta : ( is-a?/c style-delta% )

Builds a printed representation for a style-delta.

( color-prefs:unmarshall-style-delta marshalled-style-delta)
→ ( or/c false/c ( is-a?/c style-delta% ))
marshalled-style-delta : printable/c

Builds a style delta from its printed representation. Returns #f if the printed form cannot be parsed.

( color-prefs:white-on-black ) → any

Sets the colors registered by color-prefs:register-color-preference to their white-on-black variety.

( color-prefs:black-on-white ) → any

Sets the colors registered by color-prefs:register-color-preference to their black-on-white variety.
top ← prev up next →