awthemes(n7)

Name
awthemes n7 - themes for ttk

Description
The awthemes packages provides themes for use with Tcl/Tk. The awdark and awlight themes are available when the tksvg package is not present.

When the tksvg package is present, the awdark, awlight, awarc, awblack, awbreeze, awclearlooks and awwinxpblue are available. When used with tksvg, the themes have the ability to scale the various widgets.

Basic usage:
    package require awdark
    ttk::style theme use awdark

Starting with version 10.0.0, the Tcl options database may be used to set the default theme.
    echo "*TkTheme: awdark" | xrdb -merge -
    TCLLIBPATH=$(pwd) tclsh demottk.tcl \
        -optionnone -optiondflt awdark

API

::ttk::theme::${theme}::setMenuColors {-optiondb|.menuwidget}
    Sets the menu colors for a widget and also changes any checkbutton and radiobutton types to use thematic images.

When -optiondb is specified, the option database is initialized with the menu colors. Starting with version 10.0.0, this is automatic. Starting with version 10.1.2, this is no longer the case for the Windows operating system. On Windows,

::ttk::theme::${theme}::setListboxColors .listboxwidget
    Sets the listbox widget colors.

::ttk::theme::${theme}::setTextColors .textwidget [{-entry|-background}]
    Sets the text widget colors.

    If the text widget is in a normal state, the background is set to the entry background. If the text widget is in a disabled state, the background is set to the background color.

    If -entry is specified, the background is set to the same as an entry widget's background.

    If -background is specified, the background is set to the same as the normal background color.

::ttk::theme::${theme}::scaledStyle prefix defaultfont listingfont
    Creates a set of scaled widgets with a new style name.
    prefix is the prefix prepended to the names of the new styles.
    defaultfont - the standard font name (default font size).
    listingfont - the font name to scale to.

::themeutils::setBackgroundColor theme color
    Changes the background color.

    This routine must be called before the theme is initiialized.

    package require awthemes
    ::themeutils::setBackgroundColor awdark #001122
    package require awdark

::themeutils::setHighlightColor theme color
    Changes the graphics, focus and selection background colors.

    This routine must be called before the theme is initiialized.

    package require awthemes
    ::themeutils::setHighlightColor awdark #007000
    package require awdark

::ttk::theme::${theme}::getScaleFactor [scaled-style-prefix]
    Gets the scaling factor. For a scaled style, specify the prefix name. For use by the end user so that other images can be scaled appropriately.

    set theme [ttk::style theme use]
    set sf [::ttk::theme::${theme}::getScaleFactor]

    ::ttk::theme::${theme}::scaledStyle Smaller \
        TkDefaultFont mysmallfont
    set sf [::ttk::theme::${theme}::getScaleFactor Smaller]

::themeutils::setThemeColors theme colorname color ...
    A low level routine that allows modification of any color or option.

    package require awthemes
    ::themeutils::setThemeColors awdark \
        graphics.color #007000 \
        focus.color #007000
    package require awdark

    package require awthemes
    ::themeutils::setThemeColors awdark \
        scale.factor 1.5
    package require awdark

::ttk::theme::${theme}::getColor theme colorname
    A low level procedure to get the color assigned to a theme colorname.

::ttk::theme::${theme}::setBackground color
    Used after the theme has been instantiated. Attempts to change all of the colors associated with the background color. Using setBackgroundColor and restarting the application is recommended.

    set theme [::ttk::style theme use]
    if { [info commands ::ttk::theme::${theme}::setBackground] ne {} } {
        ::ttk::theme::${theme}::setBackground $newcolor
    }

Scaling
When the tksvg package is present, the awthemes package uses the
[tk scaling] setting to scale the graphics.

The scaling may also be adjusted by the user using the scale.factor option. This scaling factor is applied in addition to [tk scaling].

    package require awthemes
    ::themeutils::setThemeColors awdark \
        scale.factor 1.5
    package require awdark

Bugs
Bugs should be reported to:
https://sourceforge.net/p/tcl-awthemes/tickets/

Website
https://sourceforge.net/p/tcl-awthemes/

Author
This program is Copyright 2018-2020 by Brad Lanam.