pharo
pharo copied to clipboard
Font in stylesheet is not applied to list
Bug description
I like to apply a dark background color to a list and I like to apply a white font color. I would expect that a stylesheet as in the following code would yield the desired result, but is does not, as shown in the screenshot.
| box label list application |
label := SpLabelPresenter new
label: 'Select a number:';
yourself.
list := SpListPresenter new
items: (1 to: 10);
addStyle: 'listBackground';
yourself.
box := SpBoxLayout newTopToBottom
add: label expand: false;
add: list;
yourself.
application := SpApplication new
addStyleSheetFromString: '.application [
.listBackground [ Draw { #color: #16214A }, Font { #color: #FFFFFF } ]
]';
yourself.
SpPresenter new
application: application;
layout: box; open
Note that I clicked on number 6 and that the mouse pointer was hovering over number 9 when I took the screenshot.
Did I make a mistake in my code? According to what I read in the code, the stylesheet is correct, so I guess this is a bug.
It is also not clear to me how to apply a different selection color and a different hover color. Does Spec support that?
Version information:
- OS: MacOS Sonoma
- Version: 14.1.2
- Pharo Version: 11
Could you create your application first and add the application to create the presenters? There is a newApp: or something like that.
@Ducasse
Do you mean like this?
| box label list application |
application := SpApplication new
addStyleSheetFromString: '.application [
.listBackground [ Draw { #color: #16214A }, Font { #color: #FFFFFF } ]
]';
yourself.
label := (SpLabelPresenter newApplication: application)
label: 'Select a number:';
yourself.
list := (SpListPresenter newApplication: application)
items: (1 to: 10);
addStyle: 'listBackground';
yourself.
box := SpBoxLayout newTopToBottom
add: label expand: false;
add: list;
yourself.
(SpPresenter newApplication: application)
layout: box; open
It has the same result.
I did not check all presenters, but it does not work for SpTextInputFieldPresenter
either. Consider this code:
| box input |
application := SpApplication new
addStyleSheetFromString: '.application [
.textBackground [ Draw { #color: #16214A }, Font { #color: #FFFFFF } ]
]';
yourself.
input := (SpTextInputFieldPresenter newApplication: application)
text: 'Test';
addStyle: 'textBackground';
yourself.
box := SpBoxLayout newTopToBottom
add: input expand: false;
add: (SpListPresenter newApplication: application);
yourself.
(SpPresenter newApplication: application)
layout: box; open
At first, it looks like the white color is applied to the text:
but let's select the text (all good so far):
and let's start typing:
Now the white text color is gone. The text color is black.
Yes then I do not know. I really hope that soon we will have Toplo (the new widget library) so that people like you can spend time to improve it and let Morphic rest in peace. We should have a presentation of the new architecture end of Jan.
Yes that would be great. I really look forward to Toplo. Do you think the presentation will be available by this month's Pharo Sprint? That would be a good time to talk about it.
I don't know about Toplo, but this issue could be related to https://github.com/pharo-spec/Spec/issues/1256 So it could be closed here? @estebanlm
@hernanmd @estebanlm This issue is related to https://github.com/pharo-spec/Spec/issues/1256, but it includes more issues than mentioned there. By closing this issue, that information would be lost. Should I add a comment to https://github.com/pharo-spec/Spec/issues/1256 with the extra issues mentioned here? Or is the link to this issue enough?
Ultimately, the styling provided by the morphic backend is restrained to the limits of morphic itself.
nothing in morphic allows to directly affect the row.
this requires an enhancement on the way the style for lists/tables is applied, following what is implemented in SpMorphicProgressBarAdapter
(which implements some "substyles" for the adapter).