beetlebug▾
/

ttk::style theme

Lists, changes, and makes the themes.

ttk::style theme names
ttk::style theme use ?THEME?
ttk::style theme create THEME ?-parent PARENT? ?-settings SCRIPT?

Description

names gives the name of each theme: clam, alt, default, and classic, and the themes of the script. use with no THEME gives the current theme. With THEME, it makes THEME the theme of each themed widget.

create makes a new theme with the styles of PARENT, or of the theme default with no PARENT. settings THEME SCRIPT runs SCRIPT with THEME as the current theme of the ttk::style commands, so a configure in it changes the styles of THEME.

Returns

A list of names, a name, or an empty string.

Examples

% ttk::style theme use
default

% ttk::style theme create mine -parent default
> ttk::style theme settings mine {ttk::style configure TLabel -foreground green}
> ttk::style theme use mine
> set fg [ttk::style lookup TLabel -foreground]
> ttk::style theme use default
> set fg
green

Errors

% ttk::style theme use nosuch
theme "nosuch" doesn't exist
-errorcode NONE

% ttk::style theme create default
Theme default already exists
-errorcode NONE

% ttk::style theme bogus
bad command "bogus": must be create, names, settings, or use
-errorcode NONE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also