1.10 Color Schemes
DrRacket comes with three different color schemes, available in the preferences dialog’s color panel.
You can add your own color schemes to DrRacket, too. The first step is to create a pkg (see Creating Packages) and add an "info.rkt" file to it. The file should define framework:color-schemes as a list of hashes that describe the color schemes.
#lang info (define framework:color-schemes '(#hash((name . "Modern") (colors . ((framework:syntax-color:scheme:string #(211 72 255)) (framework:syntax-color:scheme:constant #(211 72 255)) (framework:syntax-color:scheme:comment #(194 158 31)) (framework:syntax-color:scheme:parenthesis #(0 150 255))))) #hash((name . "Tol's Color-blind-safe") (colors . ((framework:paren-match-color #(238 238 187)) (framework:syntax-color:scheme:comment #(119 34 119)) (framework:syntax-color:scheme:constant #(34 119 34)) (framework:syntax-color:scheme:error #(136 17 17)) (framework:syntax-color:scheme:hash-colon-keyword #(34 119 34)) (framework:syntax-color:scheme:keyword #(34 34 119)) (framework:syntax-color:scheme:string #(34 119 34)) (framework:syntax-color:scheme:text #(34 119 34)) (framework:syntax-color:scheme:other #(34 34 119)) (framework:syntax-color:scheme:parenthesis #(0 178 178)) (framework:syntax-color:scheme:symbol #(34 34 119)) (drracket:read-eval-print-loop:error-color #(136 17 17)) (drracket:read-eval-print-loop:out-color #(34 119 34)) (drracket:read-eval-print-loop:value-color #(34 34 119)) (drracket:check-syntax:free-variable #(136 17 17)) (drracket:check-syntax:set!d #(136 17 17)) (drracket:check-syntax:unused-require #(136 17 17))))) #hash((name . "Tol's White on Black") (colors . ((framework:paren-match-color #(34 34 119)) (framework:syntax-color:scheme:comment #(204 221 170)) (framework:syntax-color:scheme:constant #(144 179 255)) (framework:syntax-color:scheme:error #(255 204 204)) (framework:syntax-color:scheme:hash-colon-keyword #(144 179 255)) (framework:syntax-color:scheme:keyword #(144 179 255)) (framework:syntax-color:scheme:string #(144 179 255)) (framework:syntax-color:scheme:text #(144 179 255)) (framework:syntax-color:scheme:other #(144 179 255)) (framework:syntax-color:scheme:parenthesis #(119 34 119)) (framework:syntax-color:scheme:symbol #(144 179 255)) (drracket:read-eval-print-loop:error-color #(255 204 204)) (drracket:read-eval-print-loop:out-color #(34 119 34)) (drracket:read-eval-print-loop:value-color #(144 179 255)) (drracket:check-syntax:free-variable #(255 204 204)) (drracket:check-syntax:set!d #(255 204 204)) (drracket:check-syntax:unused-require #(255 204 204)))) (white-on-black-base? . #t))))
Each of the keys, e.g., (quote framework:syntax-color:scheme:string), maps to a color and possibly to some style information. All keys accept colors (the vectors shown above represent colors in r/g/b format), but only some accept style information. To find out which are which and to get a complete list of the possible keys, click the button labeled Style && Color Names at the bottom of the Color Schemes tab of the Colors tab in the preferences dialog. If one can accept style information, then you may include any of the symbols 'bold, 'underline, or 'italic in the list with the color.
Full details on the specification of the info files can be found in the documentation for the function color-prefs:register-info-based-color-schemes.
You may have to restart DrRacket (and, at least the first time after you add the "info.rkt" file, re-run raco setup) to see changes to your color scheme.
Color schemes are not limited only to the colors that DrRacket already knows about. If you are adding your own plugin to DrRacket, you can add new names that can be mapped in the color scheme. See color-prefs:register-color-preference for more information.