summaryrefslogtreecommitdiffstats
path: root/ds9
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-10-18 19:02:19 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-10-18 19:02:19 (GMT)
commit3a3e0ec6a0420753b25620f5b63fd5c087581024 (patch)
tree623ad322a98535e429cbc64fdca858cb48ffc1ad /ds9
parentb4010c3fe93d5f098be46a2cc9e8c6cc1d7bd03e (diff)
downloadblt-3a3e0ec6a0420753b25620f5b63fd5c087581024.zip
blt-3a3e0ec6a0420753b25620f5b63fd5c087581024.tar.gz
blt-3a3e0ec6a0420753b25620f5b63fd5c087581024.tar.bz2
add support for MacOS darkmode
Diffstat (limited to 'ds9')
-rw-r--r--ds9/library/colorbar.tcl3
-rw-r--r--ds9/library/ds9.tcl52
-rw-r--r--ds9/library/layout.tcl5
3 files changed, 37 insertions, 23 deletions
diff --git a/ds9/library/colorbar.tcl b/ds9/library/colorbar.tcl
index c3fa35f..dbe770e 100644
--- a/ds9/library/colorbar.tcl
+++ b/ds9/library/colorbar.tcl
@@ -70,7 +70,8 @@ proc CreateColorbar {} {
-anchor nw \
-helvetica $ds9(helvetica) \
-courier $ds9(courier) \
- -times $ds9(times)
+ -times $ds9(times) \
+ -fg $ds9(foreground) -bg $ds9(background)
$ds9(canvas) bind colorbar <Motion> [list ColorbarMotion %x %y]
$ds9(canvas) bind colorbar <Enter> [list ColorbarEnter %x %y]
diff --git a/ds9/library/ds9.tcl b/ds9/library/ds9.tcl
index f54ca53..da92c2f 100644
--- a/ds9/library/ds9.tcl
+++ b/ds9/library/ds9.tcl
@@ -76,11 +76,13 @@ proc DS9Def {} {
set ds9(display) single
- # ds9(foreground) color of GUI text
- # ds9(background) color of GUI bg
- # ds9(plot,fg) color of Plot fg
- # ds9(plot,bg) color of Plot bg
- # ds9(bg) color of canvas,frame bg
+ # ds9(foreground) color of fg text
+ # ds9(background) color of bg, canvas
+ # ds9(gui,fg) color of gui fg
+ # ds9(gui,bg) color of gui bg
+ # ds9(plot,fg) color of plot fg
+ # ds9(plot,bg) color of plot bg
+ # ds9(bg) color of frame bg
set ds9(bg) white
set ds9(array,x) 512
@@ -182,27 +184,29 @@ set ds9(app) [file tail [info nameofexecutable]]
switch $ds9(wm) {
x11 {
set ds9(foreground) black
- set ds9(background) #d9d9d9
+ set ds9(background) white
+ set ds9(gui,fg) black
+ set ds9(gui,bg) #d9d9d9
set ds9(plot,fg) black
set ds9(plot,bg) white
# standard widgets
- option add {*background} $ds9(background)
+ option add {*background} $ds9(gui,bg)
# ttk widgets
- ttk::style configure TFrame -background $ds9(background)
- ttk::style configure TLabelframe -background $ds9(background)
- ttk::style configure TLabelframe.Label -background $ds9(background)
- ttk::style configure TLabel -background $ds9(background)
- ttk::style configure TEntry -fieldbackground $ds9(background)
- ttk::style configure TButton -background $ds9(background)
- ttk::style configure TCheckbutton -background $ds9(background)
- ttk::style configure TRadiobutton -background $ds9(background)
- ttk::style configure TMenubutton -background $ds9(background)
- ttk::style configure TScale -background $ds9(background)
- ttk::style configure TScrollbar -background $ds9(background) \
- -troughcolor $ds9(background)
- ttk::style configure TProgressbar -troughcolor $ds9(background)
+ ttk::style configure TFrame -background $ds9(gui,bg)
+ ttk::style configure TLabelframe -background $ds9(gui,bg)
+ ttk::style configure TLabelframe.Label -background $ds9(gui,bg)
+ ttk::style configure TLabel -background $ds9(gui,bg)
+ ttk::style configure TEntry -fieldbackground $ds9(gui,bg)
+ ttk::style configure TButton -background $ds9(gui,bg)
+ ttk::style configure TCheckbutton -background $ds9(gui,bg)
+ ttk::style configure TRadiobutton -background $ds9(gui,bg)
+ ttk::style configure TMenubutton -background $ds9(gui,bg)
+ ttk::style configure TScale -background $ds9(gui,bg)
+ ttk::style configure TScrollbar -background $ds9(gui,bg) \
+ -troughcolor $ds9(gui,bg)
+ ttk::style configure TProgressbar -troughcolor $ds9(gui,bg)
ttk::style configure TEntry -padding 1
ttk::style configure TLabel -borderwidth 2 -padding 1
@@ -210,12 +214,16 @@ switch $ds9(wm) {
aqua {
set ds9(foreground) black
set ds9(background) white
+ set ds9(gui,fg) black
+ set ds9(gui,bg) white
set ds9(plot,fg) black
set ds9(plot,bg) white
}
win32 {
set ds9(foreground) black
set ds9(background) white
+ set ds9(gui,fg) black
+ set ds9(gui,bg) white
set ds9(plot,fg) black
set ds9(plot,bg) white
@@ -432,11 +440,15 @@ switch $ds9(wm) {
# dark mode bg #222 text #ddd
set ds9(foreground) #ddd
set ds9(background) #222
+ set ds9(gui,fg) $ds9(foreground)
+ set ds9(gui,bg) $ds9(background)
set ds9(plot,fg) $ds9(foreground)
set ds9(plot,bg) $ds9(background)
} else {
set ds9(foreground) black
set ds9(background) white
+ set ds9(gui,fg) black
+ set ds9(gui,bg) white
set ds9(plot,fg) black
set ds9(plot,bg) white
}
diff --git a/ds9/library/layout.tcl b/ds9/library/layout.tcl
index 9165d1b..da2532c 100644
--- a/ds9/library/layout.tcl
+++ b/ds9/library/layout.tcl
@@ -119,7 +119,8 @@ proc CreateCanvas {} {
set ds9(image) [ttk::frame $ds9(main).f]
set ds9(canvas) [canvas $ds9(image).c -width $ww -height $hh \
- -highlightthickness 0 -insertofftime 0 -bg $ds9(bg)]
+ -highlightthickness 0 -insertofftime 0 \
+ -bg $ds9(background)]
grid rowconfigure $ds9(image) 0 -weight 1
grid columnconfigure $ds9(image) 0 -weight 1
grid $ds9(canvas) -row 0 -column 0 -sticky news
@@ -127,7 +128,7 @@ proc CreateCanvas {} {
# extra space for window tab
if {$canvas(gap,bottom)>0} {
set f [frame $ds9(image).b -width 1 -height $canvas(gap,bottom) \
- -bg $ds9(bg)]
+ -bg $ds9(background)]
grid $f -row 1 -column 0 -sticky ew
}