Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black theme enhancements #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 35 additions & 48 deletions ttkthemes/themes/black/black.tcl
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# 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
package require Tk 8.6


namespace eval ttk {
Expand All @@ -19,27 +16,22 @@ namespace eval ttk {
}

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"
-light "#626262"
-lighter "#a9a9a9"
-lightest "white"
-selectbg "#4a6984"
-selectfg "#ffffff"
-selectfg "white"
}

if {[info commands ::ttk::style] ne ""} {
set styleCmd ttk::style
} else {
Expand All @@ -53,55 +45,45 @@ namespace eval ttk::theme::black {
#
$styleCmd configure "." \
-background $colors(-frame) \
-foreground white \
-foreground $colors(-lightest) \
-bordercolor $colors(-darkest) \
-darkcolor $colors(-dark) \
-lightcolor $colors(-lighter) \
-lightcolor $colors(-light) \
-troughcolor $colors(-darker) \
-selectbackground $colors(-selectbg) \
-selectforeground $colors(-selectfg) \
-selectborderwidth 0 \
-font TkDefaultFont \
;
-arrowcolor $colors(-lighter) \
-indicatorbackground $colors(-lighter) \
-insertcolor $colors(-lightest) \
-font TkDefaultFont

$styleCmd map "." \
-background [list disabled $colors(-frame) \
active $colors(-lighter)] \
-background [list disabled $colors(-frame) active $colors(-light)] \
-foreground [list disabled $colors(-disabledfg)] \
-selectbackground [list !focus $colors(-darkest)] \
-selectforeground [list !focus white] \
;
-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 TButton -width -8 -padding {5 2} -relief raised
$styleCmd configure Toolbutton -width -8 -padding {5 2}
$styleCmd configure TMenubutton -width -11 -padding {5 2} -relief raised

$styleCmd configure TCheckbutton -indicatormargin {1 1 4 1}
$styleCmd configure TRadiobutton -indicatormargin {1 1 4 1}

$styleCmd configure TEntry \
-fieldbackground white -foreground black \
-padding {2 0}
-fieldbackground $colors(-light) -foreground $colors(-lightest) \
-padding 4
$styleCmd configure TCombobox \
-fieldbackground white -foreground black \
-padding {2 0}
-fieldbackground $colors(-light) -foreground $colors(-lightest) \
-padding 4
$styleCmd configure TSpinbox \
-fieldbackground white -foreground black \
-padding {2 0}
-fieldbackground $colors(-light) -foreground $colors(-lightest) \
-padding 4

$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 TNotebook.Tab -padding {6 2 6 2}
$styleCmd map TNotebook.Tab -background [list selected $colors(-light)]

$styleCmd configure TreeCtrl \
-background gray30 -itembackground {gray60 gray50} \
Expand All @@ -111,7 +93,12 @@ namespace eval ttk::theme::black {
-background [list selected $colors(-selectbg)] \
-foreground [list selected $colors(-selectfg)]

$styleCmd configure Treeview -fieldbackground $colors(-lighter)
$styleCmd configure Treeview -fieldbackground $colors(-frame)

# tk widgets.
$styleCmd map Menu \
-background [list active $colors(-light)] \
-foreground [list disabled $colors(-disabledfg)]
}
}

Expand Down