My issue with the background color was how to make a TextAttribute to set
the background color of individual characters, not the overall background
of the text.

I succeeded, and Pharo 8 has a background text attribute - at least using
Rubric - see https://github.com/pharo-project/pharo/pull/5326

Christopher - thanks for the hint on doing background colors based on
theme. I did do it for the two main themes, and did not try out the larger
set of themes.

I needed it because I am working on an in-image pillar renderer for class
and package comments, and I wanted to be able to do the inline code as done
in github markdown.

There is a preview of this at:
https://github.com/kasperosterbye/PillarRichTextRender

Best,

Kasper


On 19 December 2019 at 23.07.38, Christopher Fuhrman (
christopher.fuhr...@etsmtl.ca) wrote:

If you want to consider changing background color that takes into
consideration the theme background (e.g. dark or light themes), this code
(see it on GitHub)
<https://github.com/moosetechnology/Moose-Easy/blob/f7967b310021147792858c576a41a31bdf35d7fd/src/Moose-Easy/MooseEasyFamixMakerPresenter.class.st#L279>
can
adapt to it:

normalColor := Smalltalk ui theme backgroundColor.
green := normalColor mixed: 0.8 with: Color green.
red := normalColor mixed: 0.8 with: Color red.

I didn't really test it with all possibilities of themes, however.

On Thu, 19 Dec 2019 at 12:58, Hilaire <hila...@drgeo.eu> wrote:

> You should use TextMorph.
>
> What about:
>
> || t |
> t := TextMorph new.
> t backgroundColor: Color blue.
> t contents: 'Hello'.
> t lock.
> t openInWorld||
> |
>
> Le 19/12/2019 à 15:28, Kasper Osterbye a écrit :
> > I was struggling for weeks (not every day, but still) to find out how
> > to change the system to be able to give background color to text.
> >
> --
> Dr. Geo
> http://drgeo.eu
>
>
>
>

--
Christopher Fuhrman, P.Eng., PhD

*Professeur au Département de génie logiciel et des technologies de
l'information ÉTS (École de technologie supérieure)*

Reply via email to