accessing themed colors from morph

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

accessing themed colors from morph

Peter Uhnak
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
Reply | Threaded
Open this post in threaded view
|

Re: accessing themed colors from morph

Nicolai Hess


2015-05-01 22:22 GMT+02:00 Peter Uhnák <[hidden email]>:
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

Reply | Threaded
Open this post in threaded view
|

Re: accessing themed colors from morph

Peter Uhnak
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 <[hidden email]> wrote:


2015-05-01 22:22 GMT+02:00 Peter Uhnák <[hidden email]>:
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


Reply | Threaded
Open this post in threaded view
|

Re: accessing themed colors from morph

Nicolai Hess


2015-05-01 23:54 GMT+02:00 Peter Uhnák <[hidden email]>:
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 <[hidden email]> wrote:


2015-05-01 22:22 GMT+02:00 Peter Uhnák <[hidden email]>:
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



Reply | Threaded
Open this post in threaded view
|

Re: accessing themed colors from morph

EstebanLM

On 02 May 2015, at 22:15, Nicolai Hess <[hidden email]> wrote:



2015-05-01 23:54 GMT+02:00 Peter Uhnák <[hidden email]>:
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 <[hidden email]> wrote:


2015-05-01 22:22 GMT+02:00 Peter Uhnák <[hidden email]>:
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




Reply | Threaded
Open this post in threaded view
|

Re: accessing themed colors from morph

Peter Uhnak
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

Reply | Threaded
Open this post in threaded view
|

Re: accessing themed colors from morph

Stephan Eggermont-3
On 03/05/15 12:45, Peter Uhnák wrote:
> Yes, that is what I was looking for.
> I used the self theme backgroundColor and it works for the time being.

In your application you probably want to centralize this.

Stephan