set the background and the foreground color (not just the foreground)

when switching to white-on-black mode (or back).

this causes the cursor in embedded editors to pick up the right colors
(since it is selected by the inverse of the background color of the style
of the enclosing editor snip)

closes PR 13943

original commit: 492ddab085a1d87a70843df772b044ceb84adb3d
This commit is contained in:
Robby Findler 2013-08-04 16:03:08 -05:00
parent f48631143c
commit 992482244f
3 changed files with 21 additions and 12 deletions

View File

@ -1605,10 +1605,12 @@
(proc-doc/names (proc-doc/names
editor:set-default-font-color editor:set-default-font-color
(-> (is-a?/c color%) void?) (->* ((is-a?/c color%)) ((or/c #f (is-a?/c color%))) void?)
(color) ((fg-color) ((bg-color #f)))
@{Sets the color of the style named @{Sets the foreground color of the style named
@racket[editor:get-default-color-style-name].}) @racket[editor:get-default-color-style-name] to @racket[fg-color].
If @racket[bg-color] is not @racket[#f], then @racket[editor:set-default-font-color]
sets the background color to @racket[bg-color].})
(proc-doc/names (proc-doc/names
editor:get-default-color-style-name editor:get-default-color-style-name

View File

@ -359,12 +359,13 @@
(send standard-style-list find-named-style "Standard") (send standard-style-list find-named-style "Standard")
delta)))) delta))))
(define (set-default-font-color color) (define (set-default-font-color color [bg-color #f])
(let* ([the-standard (send standard-style-list find-named-style default-color-style-name)] (define the-standard (send standard-style-list find-named-style default-color-style-name))
[the-delta (make-object style-delta%)]) (define the-delta (make-object style-delta%))
(send the-standard get-delta the-delta) (send the-standard get-delta the-delta)
(send the-delta set-delta-foreground color) (send the-delta set-delta-foreground color)
(send the-standard set-delta the-delta))) (when bg-color (send the-delta set-delta-background bg-color))
(send the-standard set-delta the-delta))
(define (set-font-size size) (define (set-font-size size)
(update-standard-style (update-standard-style

View File

@ -413,10 +413,16 @@
(preferences:set-default 'framework:coloring-active #t boolean?) (preferences:set-default 'framework:coloring-active #t boolean?)
(color-prefs:set-default/color-scheme 'framework:default-text-color "black" "white") (color-prefs:set-default/color-scheme 'framework:default-text-color "black" "white")
(define (invert-a-color color)
(make-object color%
(- 255 (send color red))
(- 255 (send color green))
(- 255 (send color blue))))
(preferences:add-callback 'framework:default-text-color (preferences:add-callback 'framework:default-text-color
(λ (p v) (λ (p v)
(editor:set-default-font-color v))) (editor:set-default-font-color v (invert-a-color v))))
(editor:set-default-font-color (preferences:get 'framework:default-text-color)) (editor:set-default-font-color (preferences:get 'framework:default-text-color)
(invert-a-color (preferences:get 'framework:default-text-color)))
(color-prefs:set-default/color-scheme 'framework:misspelled-text-color "black" "white") (color-prefs:set-default/color-scheme 'framework:misspelled-text-color "black" "white")