Group: comp.lang.tcl


Subject: Once more about colours
From: ZB
Date: 12/6/2007 5:20:39 PM
Tried to dig for some more information, how to change colours of the "themed widgets". So, trying to check out first, what colours are used presently: tclsh8.5 [~/tmp]ttk::style lookup default -background #d9d9d9 Looks OK. But then: tclsh8.5 [~/tmp]ttk::style lookup clam -background #d9d9d9 No, that "warm grey" obviously isn't the same, as the background colour used by "default" theme. tclsh8.5 [~/tmp]ttk::style lookup clamd -background #d9d9d9 Background colour of non-existing theme "clamd"? There's something wrong(?) -- ZB

Subject: Once more about colours
From: Joe English
Date: 12/7/2007 3:08:42 AM
ZB wrote: > Tried to dig for some more information, how to change colours of the "themed > widgets". So, trying to check out first, what colours are used presently: > > tclsh8.5 [~/tmp]ttk::style lookup default -background > #d9d9d9 > > Looks OK. But then: > > tclsh8.5 [~/tmp]ttk::style lookup clam -background > #d9d9d9 The first argument to [style lookup] is a style name, not a theme name. It always queries the current theme. --Joe English

Subject: Once more about colours
From: Joe English
Date: 12/8/2007 10:23:29 PM
ZB wrote: > > In fact, I noticed, that the only one(?) themed widget - ttk::label - can be > painted using tk_setPalette (perhaps that bad man ;] , who blocked > tk_setPalette's influence on themed widgets, forgot this one). Look, it's not like I set out to break all this stuff on purpose. You can't "just set the background" of a Tile widget because "the background color" is not a meaningful concept in a post-Motif world. > And it looks OK, with exception of "clam" theme (borders). That's a good example of what I'm talking about. The "clam" theme looks nice because somebody -- not me, I should add, I stole the design from XFCE :-) -- worked out that when the colors #9e9a91, #cfcdc8, and #eeebe7 are arranged _just so_ around an area colored #dcdad5, it yields a pleasant, subtly rounded button effect. If you want to use a different frame color, you need to specify two, three, or sometimes four appropriate border colors to match, depending on the theme. (This can be automated to a certain extent, but I haven't figured out exactly how yet.) > It seems, that there's no technical, rational substantiation of preventing > tk_setPalette to change colours of themed widgets? Just "it's the way, > it was meant to be"? No. The problem is that [tk_setPalette] is just not smart enough. There's more to it than just foreground, background, and a pair of shadow colors. > Why I am asking for this: OK, now we're getting somewhere! (Those who have been paying attention may have noticed that the answer to "How do I change the background of a ttk::...?" is always "Why do you *want* to change the background...?" :-) > 1. There are 4 themes: "classic" (when not modified) is not especially pretty, > "default" and "alt" are somewhat similar in their "look & feel", not much > difference, "clam" is very nice - so, in practice, from my point of view, > there are just two: "clam" - and "default/alt", which I treat as actually > one. And because of this, I could have more possibilities to "personalize" > interface of the application by changing the colours in the old way - to > make it better fit desktop decor, for example. You *could* do something like: ttk::style configure . -background #bbffbb but that's only about an 80% solution; it doesn't account for active and pressed feedback, selection colors, notebook tab colors, or any other dynamic settings in the theme. It might look OK in a screenshot, but it won't _feel_ right. To fully personalize the appearance, your best bet is to create a new theme like Bryan Oakley suggested. (With Tile you have a great deal of control over how things look; the drawback is that you also have a much greater deal of responsibility.) To get you started: see <URL: http://paste.tclers.tk/618 > That's a hacked copy of altTheme.tcl, modified to use an ugly green color scheme. All the colors in the palette are specified at the top of the file (this is a common convention for tile themes), so it should be easy to change this to whatever you like. > Why preventing it, if it won't spoil anything? Nobody's preventing anything. It's just not implemented. I think what you're asking for is perfectly reasonable, and it would be a good thing to have. (KDE supports user-defined color schemes for all its themes; that's a useful feature that Tile ought to have too.) I've worked on this some, but haven't gotten it working yet. In the meantime, you'll have to do it completely by hand. --Joe English