From 276cc630973bf15134110f18fcc5e03b07af77f9 Mon Sep 17 00:00:00 2001 From: svkalinin Date: Fri, 11 Nov 2022 16:22:50 +0300 Subject: [PATCH] Ntvs --- lib/gui.tcl | 4 +- lib/tree.tcl | 4 +- theme/black.tcl | 153 +++++++++++++++++++++++++++++++++++++++ theme/ttk_theme_dark.tcl | 44 ++++++----- 4 files changed, 184 insertions(+), 21 deletions(-) create mode 100644 theme/black.tcl diff --git a/lib/gui.tcl b/lib/gui.tcl index fe696b9..89a8afe 100644 --- a/lib/gui.tcl +++ b/lib/gui.tcl @@ -125,7 +125,9 @@ pack $frmTool.btn_tree $frmTool.btn_search $frmTool.btn_git -side top -padx 1 -p set frmTree [ttk::frame .frmBody.frmTree] set tree [ttk::treeview $frmTree.tree -show tree \ - -xscrollcommand [list .frmBody.frmTree.h set] -yscrollcommand [list .frmBody.frmTree.v set]] + -xscrollcommand [list .frmBody.frmTree.h set] \ + -yscrollcommand [list .frmBody.frmTree.v set]] + # $tree heading #0 -text "Files tree" # $tree column #0 -anchor e diff --git a/lib/tree.tcl b/lib/tree.tcl index 56bd85e..5d378e6 100644 --- a/lib/tree.tcl +++ b/lib/tree.tcl @@ -73,7 +73,7 @@ namespace eval Tree { set id [$tree selection] $tree tag remove selected $tree item $id -tags selected - + set values [$tree item $id -values] set key [lindex [split $id "::"] 0] if {$values eq "" || $key eq ""} {return} @@ -95,7 +95,7 @@ namespace eval Tree { set id [$tree selection] $tree tag remove selected $tree item $id -tags selected - + set values [$tree item $id -values] set key [lindex [split $id "::"] 0] if {$values eq "" || $key eq ""} {return} diff --git a/theme/black.tcl b/theme/black.tcl new file mode 100644 index 0000000..d140254 --- /dev/null +++ b/theme/black.tcl @@ -0,0 +1,153 @@ +# black.tcl - +# +# Experimental! +# +# Copyright (c) 2007-2008 Mats Bengtsson +# +# $Id: black.tcl,v 1.2 2009/10/25 19:21:30 oberdorfer Exp $ + +package require Tk 8.4; # minimum version for Tile +package require tile 0.8; # depends upon tile + + +namespace eval ttk { + namespace eval theme { + namespace eval black { + variable version 0.1 + } + } +} + +namespace eval ttk::theme::black { + + #variable imgdir [file join [file dirname [info script]] black] + #variable I + #array set I [tile::LoadImages $imgdir *.png] + + variable dir [file dirname [info script]] + + # NB: These colors must be in sync with the ones in black.rdb + + variable colors + array set colors { + -disabledfg "DarkGrey" + -frame "#424242" + -dark "#222222" + -darker "#121212" + -darkest "black" + -lighter "#626262" + -lightest "#ffffff" + -selectbg "#4a6984" + -selectfg "#ffffff" + } + if {[info commands ::ttk::style] ne ""} { + set styleCmd ttk::style + } else { + set styleCmd style + } + + $styleCmd theme create black -parent clam -settings { + + # ----------------------------------------------------------------- + # Theme defaults + # + $styleCmd configure "." \ + -background $colors(-frame) \ + -foreground white \ + -bordercolor $colors(-darkest) \ + -darkcolor $colors(-dark) \ + -lightcolor $colors(-lighter) \ + -troughcolor $colors(-darker) \ + -selectbackground $colors(-selectbg) \ + -selectforeground $colors(-selectfg) \ + -selectborderwidth 0 \ + -font TkDefaultFont \ + ; + + $styleCmd map "." \ + -background [list disabled $colors(-frame) \ + active $colors(-lighter)] \ + -foreground [list disabled $colors(-disabledfg)] \ + -selectbackground [list !focus $colors(-darkest)] \ + -selectforeground [list !focus white] \ + ; + + # ttk widgets. + $styleCmd configure TButton \ + -width -8 -padding {5 1} -relief raised + $styleCmd configure TMenubutton \ + -width -11 -padding {5 1} -relief raised + $styleCmd configure TCheckbutton \ + -indicatorbackground "#ffffff" -indicatormargin {1 1 4 1} + $styleCmd configure TRadiobutton \ + -indicatorbackground "#ffffff" -indicatormargin {1 1 4 1} + + $styleCmd configure TEntry \ + -fieldbackground white -foreground black \ + -padding {2 0} + $styleCmd configure TCombobox \ + -fieldbackground white -foreground black \ + -padding {2 0} + $styleCmd configure TSpinbox \ + -fieldbackground white -foreground black \ + -padding {2 0} + + $styleCmd configure TNotebook.Tab \ + -padding {6 2 6 2} + + $styleCmd map TNotebook.Tab -background [list \ + selected $colors(-lighter)] + + # tk widgets. + $styleCmd map Menu \ + -background [list active $colors(-lighter)] \ + -foreground [list disabled $colors(-disabledfg)] + + $styleCmd configure TreeCtrl \ + -background gray30 -itembackground {gray60 gray50} \ + -itemfill white -itemaccentfill yellow + + $styleCmd map Treeview \ + -background [list selected $colors(-selectbg)] \ + -foreground [list selected $colors(-selectfg)] + + $styleCmd configure Treeview -fieldbackground $colors(-lighter) + } +} + +# A few tricks for Tablelist. + +namespace eval ::tablelist:: { + + proc blackTheme {} { + variable themeDefaults + + array set colors [array get ttk::theme::black::colors] + + array set themeDefaults [list \ + -background "Black" \ + -foreground "White" \ + -disabledforeground $colors(-disabledfg) \ + -stripebackground "#191919" \ + -selectbackground "#4a6984" \ + -selectforeground "DarkRed" \ + -selectborderwidth 0 \ + -font TkTextFont \ + -labelbackground $colors(-frame) \ + -labeldisabledBg "#dcdad5" \ + -labelactiveBg "#eeebe7" \ + -labelpressedBg "#eeebe7" \ + -labelforeground white \ + -labeldisabledFg "#999999" \ + -labelactiveFg white \ + -labelpressedFg white \ + -labelfont TkDefaultFont \ + -labelborderwidth 2 \ + -labelpady 1 \ + -arrowcolor "" \ + -arrowstyle sunken10x9 \ + ] + } +} + +package provide ttk::theme::black $::ttk::theme::black::version diff --git a/theme/ttk_theme_dark.tcl b/theme/ttk_theme_dark.tcl index 0db0db6..1782575 100644 --- a/theme/ttk_theme_dark.tcl +++ b/theme/ttk_theme_dark.tcl @@ -40,23 +40,27 @@ namespace eval ttk::theme::dark { # Theme defaults # ttk::style configure . \ - -background $colors(-frame) \ - -foreground #ffffff \ - -bordercolor $colors(-darkest) \ - -darkcolor $colors(-dark) \ - -lightcolor $colors(-lighter) \ - -troughcolor $colors(-darker) \ - -selectbackground $colors(-selectbg) \ - -selectforeground $colors(-selectfg) \ - -selectborderwidth 0 \ - -font "{Droid Sans Mono} 9" - + -background $colors(-frame) \ + -foreground #ffffff \ + -bordercolor $colors(-darkest) \ + -darkcolor $colors(-dark) \ + -lightcolor $colors(-lighter) \ + -troughcolor $colors(-darker) \ + -selectborderwidth 1 \ + -font "{Droid Sans Mono} 9" \ + -selectbackground $colors(-selectbg) \ + -selectforeground $colors(-selectfg) \ + ttk::style map "." \ - -background [list disabled $colors(-frame) \ - active $colors(-lighter)] \ - -foreground [list disabled $colors(-disabledfg)] \ - -selectbackground [list !focus $colors(-darkest)] \ - -selectforeground [list !focus #ffffff] + -background [list disabled $colors(-frame) \ + active $colors(-lighter)] \ + -foreground [list disabled $colors(-disabledfg)] \ + -selectbackground [list !focus $colors(-darkest)] \ + -selectforeground [list !focus #ffffff] + + # \ + # -selectbackground [list !focus $colors(-darkest)] \ + # -selectforeground [list !focus #ffffff] # ttk widgets. ttk::style configure TButton \ @@ -81,7 +85,7 @@ namespace eval ttk::theme::dark { -fieldbackground $colors(-lightframe) \ -foreground #ffffff - ttk::style configure TNotebook + # ttk::style configure TNotebook # -bordercolor $colors(-frame) ttk::style configure TNotebook.Tab \ -padding {6 2 6 2} @@ -93,7 +97,7 @@ namespace eval ttk::theme::dark { ttk::style map Menu \ -background [list active $colors(-lighter)] \ -foreground [list disabled $colors(-disabledfg)] - + ttk::style configure Treeview \ -background $colors(-treebg) -itembackground {gray60 gray50} \ -itemfill #ffffff -itemaccentfill yellow \ @@ -102,6 +106,10 @@ namespace eval ttk::theme::dark { # -indicatorsize -1 \ # -padding 0 + ttk::style configure TreeCtrl \ + -background gray30 -itembackground {gray60 gray50} \ + -itemfill white -itemaccentfill yellow + ttk::style configure Text \ -linemapbg [list active $colors(-linemapbg)]\ -linemapfg [list active $colors(-linemapfg)]\