Compare commits
10 commits
950d5143d7
...
e75b311a33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e75b311a33 | ||
|
|
2b1e95b516 | ||
|
|
03f5d409e2 | ||
|
|
3825fa37c1 | ||
|
|
c844e4aaf2 | ||
|
|
cf0928953b | ||
|
|
16cd2d12ba | ||
|
|
f7260808ed | ||
|
|
c793142eb1 | ||
|
|
0a349a4a34 |
4 changed files with 114 additions and 75 deletions
|
|
@ -10,7 +10,5 @@ you can save the current (applied) theme to be used the next time pd starts by h
|
|||
On OSX if you select a theme from the list and click "Save as Dark Theme" then that theme will open instead if you're in dark mode when you open pd.
|
||||
In order to stop using a specific theme for dark mode you can click "Delete Dark Theme"
|
||||
|
||||
If a color theme is chosen that doesn't have colors set for certain elements of the canvas window, text window, or helpbrowser window then those windows will have to be recreated before the default values are displayed. (tk makes it difficult to get default color values)
|
||||
|
||||
In order to include more themes, put them in the "themes" folder inside. But only include setting colors in the files or else other things can get messed up when
|
||||
the list gets drawn.
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ proc ::color-themes::reset_defaults {} {
|
|||
comment "#000"
|
||||
graph_outline "#000"
|
||||
graph_text "#000"
|
||||
graph_open "#c0c0c0"
|
||||
array_name "#000"
|
||||
array_values "#000"
|
||||
gop_box "#FF8080"
|
||||
|
|
@ -91,22 +92,26 @@ proc ::color-themes::set_theme {name} {
|
|||
pdsend "$wind map 0"
|
||||
pdsend "$wind map 1"
|
||||
set tmpcol [::pdtk_canvas::get_color txt_highlight $wind]
|
||||
if {$tmpcol ne ""} {
|
||||
${wind}.c configure -selectbackground $tmpcol
|
||||
# idk about an easier way to set stuff to default
|
||||
if {$tmpcol eq ""} {
|
||||
set tmpcol [lindex [${wind}.c configure -selectbackground] 3]
|
||||
}
|
||||
${wind}.c configure -selectbackground $tmpcol
|
||||
set tmpcol [::pdtk_canvas::get_color canvas_fill $wind]
|
||||
if {$tmpcol ne ""} {
|
||||
${wind}.c configure -background $tmpcol
|
||||
if {$tmpcol eq ""} {
|
||||
set tmpcol [lindex [${wind}.c configure -background] 3]
|
||||
}
|
||||
${wind}.c configure -background $tmpcol
|
||||
set tmpcol [::pdtk_canvas::get_color canvas_text_cursor $wind]
|
||||
if {$tmpcol ne ""} {
|
||||
${wind}.c configure -insertbackground $tmpcol
|
||||
if {$tmpcol eq ""} {
|
||||
set tmpcol [lindex [${wind}.c configure -insertbackground] 3]
|
||||
}
|
||||
#in Tk 8.6 the selectforeground is set by the os theme?
|
||||
${wind}.c configure -insertbackground $tmpcol
|
||||
set tmpcol [::pdtk_canvas::get_color txt_highlight_front $wind]
|
||||
if {$tmpcol ne ""} {
|
||||
${wind}.c configure -selectforeground $tmpcol
|
||||
if {$tmpcol eq ""} {
|
||||
set tmpcol [lindex [${wind}.c configure -selectforeground] 3]
|
||||
}
|
||||
${wind}.c configure -selectforeground $tmpcol
|
||||
} elseif {[winfo class $wind] eq "HelpBrowser"} {
|
||||
foreach child [winfo children .helpbrowser.c.f] {
|
||||
if {[winfo class $child] eq "Listbox"} {
|
||||
|
|
@ -117,25 +122,30 @@ proc ::color-themes::set_theme {name} {
|
|||
# assume text window if text widget
|
||||
if {[winfo exists $wind.text]} {
|
||||
set tmpcol [::pdtk_canvas::get_color text_window_text $wind]
|
||||
if {$tmpcol ne ""} {
|
||||
$wind.text configure -foreground $tmpcol
|
||||
if {$tmpcol eq ""} {
|
||||
set tmpcol [lindex [${wind}.text configure -foreground] 3]
|
||||
}
|
||||
${wind}.text configure -foreground $tmpcol
|
||||
set tmpcol [::pdtk_canvas::get_color text_window_cursor $wind]
|
||||
if {$tmpcol ne ""} {
|
||||
$wind.text configure -insertbackground $tmpcol
|
||||
if {$tmpcol eq ""} {
|
||||
set tmpcol [lindex [${wind}.text configure -insertbackground] 3]
|
||||
}
|
||||
${wind}.text configure -insertbackground $tmpcol
|
||||
set tmpcol [::pdtk_canvas::get_color text_window_fill $wind]
|
||||
if {$tmpcol ne ""} {
|
||||
$wind.text configure -background $tmpcol
|
||||
if {$tmpcol eq ""} {
|
||||
set tmpcol [lindex [${wind}.text configure -background] 3]
|
||||
}
|
||||
${wind}.text configure -background $tmpcol
|
||||
set tmpcol [::pdtk_canvas::get_color text_window_highlight $wind]
|
||||
if {$tmpcol ne ""} {
|
||||
$wind.text configure -selectbackground $tmpcol
|
||||
if {$tmpcol eq ""} {
|
||||
set tmpcol [lindex [${wind}.text configure -selectbackground] 3]
|
||||
}
|
||||
${wind}.text configure -selectbackground $tmpcol
|
||||
set tmpcol [::pdtk_canvas::get_color text_window_hl_text $wind]
|
||||
if {$tmpcol ne ""} {
|
||||
$wind.text configure -selectforeground $tmpcol
|
||||
if {$tmpcol eq ""} {
|
||||
set tmpcol [lindex [${wind}.text configure -selectforeground] 3]
|
||||
}
|
||||
${wind}.text configure -selectforeground $tmpcol
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -211,6 +221,7 @@ proc ::color-themes::click {box} {
|
|||
proc ::color-themes::scroll {box coord units boxincr} {
|
||||
variable num_themes
|
||||
# not sure of a better way to simulate hovering..
|
||||
#::pdwindow::post "box: $box coord: $coord units: $units boxincr: $boxincr\n"
|
||||
set ocanvy [.colortheme_dialog.theme_list.c canvasy 0]
|
||||
.colortheme_dialog.theme_list.c yview scroll [expr {- ($units)}] units
|
||||
{::color-themes::motion} [expr max(0, min($box + int($coord + \
|
||||
|
|
@ -218,6 +229,16 @@ proc ::color-themes::scroll {box coord units boxincr} {
|
|||
$num_themes-1))]
|
||||
}
|
||||
|
||||
proc ::color-themes::mainscroll {coord units boxincr} {
|
||||
variable num_themes
|
||||
#::pdwindow::post "coord: $coord units: $units boxincr: $boxincr\n"
|
||||
set coord [.colortheme_dialog.theme_list.c canvasy $coord]
|
||||
set ocanvy [.colortheme_dialog.theme_list.c canvasy 0]
|
||||
.colortheme_dialog.theme_list.c yview scroll [expr {- ($units)}] units
|
||||
{::color-themes::motion} [expr max(0, min(int($coord + \
|
||||
[.colortheme_dialog.theme_list.c canvasy 0] - $ocanvy)/$boxincr, $num_themes - 1))]
|
||||
}
|
||||
|
||||
proc ::color-themes::apply {names} {
|
||||
variable selected_theme
|
||||
if {$selected_theme eq ""} {return}
|
||||
|
|
@ -318,12 +339,21 @@ proc ::color-themes::opendialog {} {
|
|||
grid .colortheme_dialog.theme_list.c.f$counter.c
|
||||
bind .colortheme_dialog.theme_list.c.f$counter.c <MouseWheel> \
|
||||
[list {::color-themes::scroll} $counter %y %D $boxincr]
|
||||
|
||||
if {$::windowingsystem eq "win32"} {
|
||||
.colortheme_dialog.theme_list.c.f$counter.c configure \
|
||||
-yscrollincrement 1
|
||||
}
|
||||
if {$::windowingsystem eq "x11"} {
|
||||
# from http://wiki.tcl.tk/3893
|
||||
bind .colortheme_dialog.theme_list.c.f$counter.c <Button-4> \
|
||||
{event generate %W <MouseWheel> -delta 1}
|
||||
{event generate %W <MouseWheel> -delta 1 -y %y}
|
||||
bind .colortheme_dialog.theme_list.c.f$counter.c <Button-5> \
|
||||
{event generate %W <MouseWheel> -delta -1}
|
||||
{event generate %W <MouseWheel> -delta -1 -y %y}
|
||||
bind .colortheme_dialog.theme_list.c.f$counter.c <Shift-Button-4> \
|
||||
{break}
|
||||
bind .colortheme_dialog.theme_list.c.f$counter.c <Shift-Button-5> \
|
||||
{break}
|
||||
}
|
||||
bind .colortheme_dialog.theme_list.c.f$counter.c <Motion> \
|
||||
[list {::color-themes::motion} $counter]
|
||||
|
|
@ -502,17 +532,29 @@ proc ::color-themes::opendialog {} {
|
|||
grid configure .colortheme_dialog.close -pady 5
|
||||
grid configure .colortheme_dialog.save -pady 5
|
||||
}
|
||||
bind .colortheme_dialog.theme_list.c <MouseWheel> {
|
||||
.colortheme_dialog.theme_list.c yview scroll [expr {- (%D)}] units
|
||||
bind .colortheme_dialog.theme_list.c <MouseWheel> \
|
||||
[list {::color-themes::mainscroll} %y %D $boxincr]
|
||||
if {$::windowingsystem eq "win32"} {
|
||||
.colortheme_dialog.theme_list.c configure -yscrollincrement 1
|
||||
}
|
||||
if {$::windowingsystem eq "x11"} {
|
||||
# from http://wiki.tcl.tk/3893
|
||||
bind .colortheme_dialog.theme_list.c <Button-4> \
|
||||
{event generate %W <MouseWheel> -delta 1}
|
||||
{event generate %W <MouseWheel> -delta 1 -y %y}
|
||||
bind .colortheme_dialog.theme_list.c <Button-5> \
|
||||
{event generate %W <MouseWheel> -delta -1}
|
||||
{event generate %W <MouseWheel> -delta -1 -y %y}
|
||||
bind .colortheme_dialog.theme_list.c <Shift-Button-4> \
|
||||
{break}
|
||||
bind .colortheme_dialog.theme_list.c <Shift-Button-5> \
|
||||
{break}
|
||||
}
|
||||
bind .colortheme_dialog.theme_list.c <Leave> {
|
||||
# on xfwm and openbox <Enter> and <Leave> events are generated when the scroll wheel is used
|
||||
# or the mouse is clicked, so <Leave> and <Enter> can't be used directly and I have to
|
||||
# calculate the geometry for which canvas is hovered manually
|
||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929090
|
||||
# https://linux.debian.user.narkive.com/dXxiVBcM/strange-event-handling-problem-with-xfce-lxde-which-pkg-responsible
|
||||
bind .colortheme_dialog <Motion><Leave> {
|
||||
#::pdwindow::post "leave\n"
|
||||
if {${::color-themes::hover_theme} ne "" && \
|
||||
${::color-themes::selected_theme} ne ${::color-themes::hover_theme}} {
|
||||
.colortheme_dialog.theme_list.c.f${::color-themes::hover_theme}.c \
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ msg_cord "#121"
|
|||
signal_cord "#558"
|
||||
obj_box_outline_broken "#f00"
|
||||
canvas_fill "white"
|
||||
|
||||
}
|
||||
set ::pd_colors(signal_iolet_border) $::pd_colors(signal_cord)
|
||||
set ::pd_colors(msg_iolet_border) $::pd_colors(msg_cord)
|
||||
set ::pd_colors(atom_box_focus_outline) $::pd_colors(atom_box_outline)
|
||||
set ::pd_colors(array_name) $::pd_colors(graph_outline)
|
||||
|
|
@ -40,49 +40,50 @@
|
|||
# helpbrowser_highlight - like txt_highlight but for help browser
|
||||
|
||||
array set ::pd_colors {
|
||||
canvas_fill "#FF8800"
|
||||
gop_box "black"
|
||||
obj_box_text "#00FF00"
|
||||
msg_box_text "white"
|
||||
comment "blue"
|
||||
selected "yellow"
|
||||
obj_box_outline_broken "light blue"
|
||||
obj_box_outline "#0B8100"
|
||||
msg_box_outline "purple"
|
||||
msg_box_fill "purple"
|
||||
obj_box_fill "#0B8100"
|
||||
signal_cord "blue"
|
||||
msg_cord "black"
|
||||
msg_iolet "white"
|
||||
signal_iolet "blue"
|
||||
graph_outline "blue"
|
||||
selection_rectangle "light green"
|
||||
txt_highlight "black"
|
||||
graph_text "purple"
|
||||
array_name "#0B8100"
|
||||
array_values "purple"
|
||||
atom_box_fill "black"
|
||||
atom_box_text "cyan"
|
||||
atom_box_label "black"
|
||||
atom_box_outline "cyan"
|
||||
atom_box_focus_outline "red"
|
||||
text_window_fill "black"
|
||||
text_window_text "white"
|
||||
text_window_highlight "green"
|
||||
text_window_hl_text "white"
|
||||
text_window_cursor "green"
|
||||
pdwindow_fill "#000"
|
||||
pdwindow_fatal_text "#D00"
|
||||
pdwindow_fatal_highlight "#FFE0E8"
|
||||
pdwindow_error_text "#D00"
|
||||
pdwindow_post_text "deep sky blue"
|
||||
pdwindow_debug_text "green"
|
||||
pdwindow_hl_text "blue"
|
||||
helpbrowser_fill "#000"
|
||||
helpbrowser_text "deep sky blue"
|
||||
helpbrowser_highlight "red"
|
||||
canvas_text_cursor "deep sky blue"
|
||||
helpbrowser_hl_text "white"
|
||||
canvas_fill "#FF8800"
|
||||
gop_box "black"
|
||||
obj_box_text "#00FF00"
|
||||
msg_box_text "white"
|
||||
comment "blue"
|
||||
selected "yellow"
|
||||
obj_box_outline_broken "light blue"
|
||||
obj_box_outline "#0B8100"
|
||||
msg_box_outline "purple"
|
||||
msg_box_fill "purple"
|
||||
obj_box_fill "#0B8100"
|
||||
signal_cord "blue"
|
||||
msg_cord "black"
|
||||
msg_iolet "white"
|
||||
signal_iolet "blue"
|
||||
graph_outline "blue"
|
||||
graph_open "white"
|
||||
selection_rectangle "light green"
|
||||
txt_highlight "black"
|
||||
graph_text "purple"
|
||||
array_name "#0B8100"
|
||||
array_values "purple"
|
||||
atom_box_fill "black"
|
||||
atom_box_text "cyan"
|
||||
atom_box_label "black"
|
||||
atom_box_outline "cyan"
|
||||
atom_box_focus_outline "red"
|
||||
text_window_fill "black"
|
||||
text_window_text "white"
|
||||
text_window_highlight "green"
|
||||
text_window_hl_text "white"
|
||||
text_window_cursor "green"
|
||||
pdwindow_fill "#000"
|
||||
pdwindow_fatal_text "#D00"
|
||||
pdwindow_fatal_highlight "#FFE0E8"
|
||||
pdwindow_error_text "#D00"
|
||||
pdwindow_post_text "deep sky blue"
|
||||
pdwindow_debug_text "green"
|
||||
pdwindow_hl_text "blue"
|
||||
helpbrowser_fill "#000"
|
||||
helpbrowser_text "deep sky blue"
|
||||
helpbrowser_highlight "red"
|
||||
canvas_text_cursor "deep sky blue"
|
||||
helpbrowser_hl_text "white"
|
||||
}
|
||||
set ::pd_colors(txt_highlight_front) "$::pd_colors(selected)"
|
||||
set ::pd_colors(msg_iolet_border) "blue"
|
||||
|
|
|
|||
Loading…
Reference in a new issue