accessing themed colors from morph
Hi, how is set the background color of a morph? I could access directly "Smalltalk ui theme backgroundColor" from within the Morph, but I don't see anywhere that something is using themed colors this way. So I assume there is some other way; what am I missing? Note that I don't want to use the color for background of the morph but I need to make a decision based on the color in the morph. Thanks, Peter
2015-05-01 22:22 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com>:
Hi,
how is set the background color of a morph?
A morph has the fillStyle/color attribute, but this does not mean it uses this color for its drawing method. (for example ActiveHand color -> Color blue, and the hand/cursor is not blue).
I could access directly "Smalltalk ui theme backgroundColor" from within the Morph,
this returns always the same color, it is actually the desktop backgroundcolor.
but I don't see anywhere that something is using themed colors this way. So I assume there is some other way; what am I missing?
Note that I don't want to use the color for background of the morph but I need to make a decision based on the color in the morph.
It depends on the morph, or the type of widget this morph represents. A button has a theme dependent color, that may depend on the type and state (enabled/disabled) of the button. A list morph may have different colors for even and odd index, selected, enabled, disabled ... A label model font/color may depend on its use (window title/menu title/ button label ...). Look at the xxxFillStyleFor: messages in UITheme
Thanks, Peter
Thank's for the pointers. It seems to me that they access it via 'self theme'; in any case my problem is, for the moment, solved. Thanks, Peter On Fri, May 1, 2015 at 11:11 PM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-01 22:22 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com>:
Hi,
how is set the background color of a morph?
A morph has the fillStyle/color attribute, but this does not mean it uses this color for its drawing method. (for example ActiveHand color -> Color blue, and the hand/cursor is not blue).
I could access directly "Smalltalk ui theme backgroundColor" from within the Morph,
this returns always the same color, it is actually the desktop backgroundcolor.
but I don't see anywhere that something is using themed colors this way. So I assume there is some other way; what am I missing?
Note that I don't want to use the color for background of the morph but I need to make a decision based on the color in the morph.
It depends on the morph, or the type of widget this morph represents. A button has a theme dependent color, that may depend on the type and state (enabled/disabled) of the button. A list morph may have different colors for even and odd index, selected, enabled, disabled ... A label model font/color may depend on its use (window title/menu title/ button label ...).
Look at the xxxFillStyleFor: messages in UITheme
Thanks, Peter
2015-05-01 23:54 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com>:
Thank's for the pointers. It seems to me that they access it via 'self theme'; in any case my problem is, for the moment, solved.
Yes but, 'self theme' is 'the theme engine that defines all theme settings' and 'self theme backgroundColor' is 'what this theme defines as general backgroundColor' It does not mean that self (the morph) is actually using this theme setting for anything. For a panel morph, that normally uses 'Color transparent' for its color, would answer to 'self theme backgroundColor' with the same answer as any other morph. It is the 'theme backgroundColor' not the morphs background color.
Thanks, Peter
On Fri, May 1, 2015 at 11:11 PM, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-01 22:22 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com>:
Hi,
how is set the background color of a morph?
A morph has the fillStyle/color attribute, but this does not mean it uses this color for its drawing method. (for example ActiveHand color -> Color blue, and the hand/cursor is not blue).
I could access directly "Smalltalk ui theme backgroundColor" from within the Morph,
this returns always the same color, it is actually the desktop backgroundcolor.
but I don't see anywhere that something is using themed colors this way. So I assume there is some other way; what am I missing?
Note that I don't want to use the color for background of the morph but I need to make a decision based on the color in the morph.
It depends on the morph, or the type of widget this morph represents. A button has a theme dependent color, that may depend on the type and state (enabled/disabled) of the button. A list morph may have different colors for even and odd index, selected, enabled, disabled ... A label model font/color may depend on its use (window title/menu title/ button label ...).
Look at the xxxFillStyleFor: messages in UITheme
Thanks, Peter
On 02 May 2015, at 22:15, Nicolai Hess <nicolaihess@web.de> wrote:
2015-05-01 23:54 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com <mailto:i.uhnak@gmail.com>>: Thank's for the pointers. It seems to me that they access it via 'self theme'; in any case my problem is, for the moment, solved.
Yes but, 'self theme' is 'the theme engine that defines all theme settings' and 'self theme backgroundColor' is 'what this theme defines as general backgroundColor' It does not mean that self (the morph) is actually using this theme setting for anything.
For a panel morph, that normally uses 'Color transparent' for its color, would answer to 'self theme backgroundColor' with the same answer as any other morph. It is the 'theme backgroundColor' not the morphs background color.
Thanks, Peter
On Fri, May 1, 2015 at 11:11 PM, Nicolai Hess <nicolaihess@web.de <mailto:nicolaihess@web.de>> wrote:
2015-05-01 22:22 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com <mailto:i.uhnak@gmail.com>>: Hi,
how is set the background color of a morph?
A morph has the fillStyle/color attribute, but this does not mean it uses this color for its drawing method. (for example ActiveHand color -> Color blue, and the hand/cursor is not blue).
I could access directly "Smalltalk ui theme backgroundColor" from within the Morph,
this returns always the same color, it is actually the desktop backgroundcolor.
no, it is not. it is the general background color (that should be applied *by default* to all morphs that recognises the background property), as Nicolai pointed. Now⦠all that is really messy and bad structured (and worst documented)⦠so do not expect it works all the time. Esteban
but I don't see anywhere that something is using themed colors this way. So I assume there is some other way; what am I missing?
Note that I don't want to use the color for background of the morph but I need to make a decision based on the color in the morph.
It depends on the morph, or the type of widget this morph represents. A button has a theme dependent color, that may depend on the type and state (enabled/disabled) of the button. A list morph may have different colors for even and odd index, selected, enabled, disabled ... A label model font/color may depend on its use (window title/menu title/ button label ...).
Look at the xxxFillStyleFor: messages in UITheme
Thanks, Peter
Yes but, 'self theme' is 'the theme engine that defines all theme settings' and 'self theme backgroundColor' is 'what this theme defines as general backgroundColor' It does not mean that self (the morph) is actually using this theme setting for anything.
I know, I don't care if the morph itself uses it somewhere or not, I
wanted color that _should_ be used as a background, so I can apply it to some part of the morph myself. it is the general background color (that should be applied *by default* to
all morphs that recognises the background property), as Nicolai pointed.
Yes, that is what I was looking for. I used the self theme backgroundColor and it works for the time being. Peter
participants (4)
-
Esteban Lorenzano -
Nicolai Hess -
Peter Uhnák -
Stephan Eggermont