Theme aware-ish TRMorph

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

Theme aware-ish TRMorph

Peter Uhnak
Hi,

since I wanted to use DarkTheme I played around with TRMorph (since seeing giant white rectangle in dark theme is not very nice).

What I have done is moved the background color setting to `surface clear:` (instead of the original aCanvas fillRectangle).

And then if theme background luminance is dark (>0.5), I invert all the colors in the visualization.
For dark theme the background is black, and not the theme background - at least to me it seems that black is much clearer.

Is this something that could be incorporated?




And the modified code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"protocol: drawing"
TRMorph>>drawOn: aCanvas
"aCanvas is a FormCanvas"
self checkSession.
"aCanvas fillRectangle: bounds color: trachelCanvas color."
trachelCanvas playAnimations.
"The drawing has to be done when a change in the shapes occured or when there is an animation."
surface drawDuring: [:cs |
surface clear: trachelCanvas color.
"We display the elements that are subject to the camera"
cs pathTransform
translateBy: (self extent / 2) asFloatPoint;
   scaleBy: trachelCanvas camera scale asFloat;
translateBy: trachelCanvas camera position negated asFloatPoint.
trachelCanvas shapes do: [ :trachelShape |
trachelShape drawOn: cs.
].
"We display the elements that are _NOT_ subject to the camera"
cs pathTransform loadIdentity scaleBy: 1.001.
trachelCanvas fixedShapes do: [ :trachelShape |
trachelShape drawOn: cs.
].
].
self theme backgroundColor luminance < 0.5 ifTrue: [
surface drawDuring: [ :cs |
cs paintMode restoreAfter: [
cs setPaint: Color white.
cs paintMode difference.
cs drawShape: (0 @ 0 extent: surface extent)
]
]
].
"aCanvas translucentImage: surface asForm at: self bounds origin."
"asForm creates a new Form, which is likely to be expensive. This can be cached"
aCanvas image: surface asForm at: self bounds origin sourceRect: (0 @ 0 extent: surface extent) rule: 34.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

philippeback

Why invert the colors?

Because lines are black?

Phil

Le 2 mai 2015 00:08, "Peter Uhnák" <[hidden email]> a écrit :
Hi,

since I wanted to use DarkTheme I played around with TRMorph (since seeing giant white rectangle in dark theme is not very nice).

What I have done is moved the background color setting to `surface clear:` (instead of the original aCanvas fillRectangle).

And then if theme background luminance is dark (>0.5), I invert all the colors in the visualization.
For dark theme the background is black, and not the theme background - at least to me it seems that black is much clearer.

Is this something that could be incorporated?




And the modified code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"protocol: drawing"
TRMorph>>drawOn: aCanvas
"aCanvas is a FormCanvas"
self checkSession.
"aCanvas fillRectangle: bounds color: trachelCanvas color."
trachelCanvas playAnimations.
"The drawing has to be done when a change in the shapes occured or when there is an animation."
surface drawDuring: [:cs |
surface clear: trachelCanvas color.
"We display the elements that are subject to the camera"
cs pathTransform
translateBy: (self extent / 2) asFloatPoint;
   scaleBy: trachelCanvas camera scale asFloat;
translateBy: trachelCanvas camera position negated asFloatPoint.
trachelCanvas shapes do: [ :trachelShape |
trachelShape drawOn: cs.
].
"We display the elements that are _NOT_ subject to the camera"
cs pathTransform loadIdentity scaleBy: 1.001.
trachelCanvas fixedShapes do: [ :trachelShape |
trachelShape drawOn: cs.
].
].
self theme backgroundColor luminance < 0.5 ifTrue: [
surface drawDuring: [ :cs |
cs paintMode restoreAfter: [
cs setPaint: Color white.
cs paintMode difference.
cs drawShape: (0 @ 0 extent: surface extent)
]
]
].
"aCanvas translucentImage: surface asForm at: self bounds origin."
"asForm creates a new Form, which is likely to be expensive. This can be cached"
aCanvas image: surface asForm at: self bounds origin sourceRect: (0 @ 0 extent: surface extent) rule: 34.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

Peter Uhnak

Why invert the colors?

Because I cannot make assumptions about what colors are in the visualization.
So if I were to just change the background (which I can), then all black elements will become invisible.

Because lines are black?

Lines are one example.

Peter

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

Peter Uhnak
Arguably this is something that probably should be configurable. As sometimes you would want to see the "correct" colors even with a dark theme.

Peter

On Sat, May 2, 2015 at 12:43 AM, Peter Uhnák <[hidden email]> wrote:

Why invert the colors?

Because I cannot make assumptions about what colors are in the visualization.
So if I were to just change the background (which I can), then all black elements will become invisible.

Because lines are black?

Lines are one example.

Peter


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

EstebanLM
In reply to this post by Peter Uhnak
nice.
you will want to use the Idea icon pack with dark theme… experience is highly improved :)

Esteban

> On 02 May 2015, at 00:08, Peter Uhnák <[hidden email]> wrote:
>
> Hi,
>
> since I wanted to use DarkTheme I played around with TRMorph (since seeing giant white rectangle in dark theme is not very nice).
>
> What I have done is moved the background color setting to `surface clear:` (instead of the original aCanvas fillRectangle).
>
> And then if theme background luminance is dark (>0.5), I invert all the colors in the visualization.
> For dark theme the background is black, and not the theme background - at least to me it seems that black is much clearer.
>
> Is this something that could be incorporated?
>
> <2015-05-02_00:05:11.png>
> ​
>
> And the modified code:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "protocol: drawing"
> TRMorph>>drawOn: aCanvas
> "aCanvas is a FormCanvas"
>
> self checkSession.
>
> "aCanvas fillRectangle: bounds color: trachelCanvas color."
> trachelCanvas playAnimations.
>
> "The drawing has to be done when a change in the shapes occured or when there is an animation."
> surface drawDuring: [:cs |
> surface clear: trachelCanvas color.
>
> "We display the elements that are subject to the camera"
> cs pathTransform
> translateBy: (self extent / 2) asFloatPoint;
>    scaleBy: trachelCanvas camera scale asFloat;
> translateBy: trachelCanvas camera position negated asFloatPoint.
> trachelCanvas shapes do: [ :trachelShape |
> trachelShape drawOn: cs.
> ].
>
> "We display the elements that are _NOT_ subject to the camera"
> cs pathTransform loadIdentity scaleBy: 1.001.
> trachelCanvas fixedShapes do: [ :trachelShape |
> trachelShape drawOn: cs.
> ].
> ].
>
> self theme backgroundColor luminance < 0.5 ifTrue: [
> surface drawDuring: [ :cs |
> cs paintMode restoreAfter: [
> cs setPaint: Color white.
> cs paintMode difference.
> cs drawShape: (0 @ 0 extent: surface extent)
> ]
> ]
> ].
>
> "aCanvas translucentImage: surface asForm at: self bounds origin."
> "asForm creates a new Form, which is likely to be expensive. This can be cached"
> aCanvas image: surface asForm at: self bounds origin sourceRect: (0 @ 0 extent: surface extent) rule: 34.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

philippeback


Le 2 mai 2015 09:45, "Esteban Lorenzano" <[hidden email]> a écrit :
>
> nice.
> you will want to use the Idea icon pack with dark theme… experience is highly improved :)

Yes!

I like the exception icons a bit more "different" than "generic blueish". I'll do yellow/orange ones.

Phil
>
> Esteban
>
> > On 02 May 2015, at 00:08, Peter Uhnák <[hidden email]> wrote:
> >
> > Hi,
> >
> > since I wanted to use DarkTheme I played around with TRMorph (since seeing giant white rectangle in dark theme is not very nice).
> >
> > What I have done is moved the background color setting to `surface clear:` (instead of the original aCanvas fillRectangle).
> >
> > And then if theme background luminance is dark (>0.5), I invert all the colors in the visualization.
> > For dark theme the background is black, and not the theme background - at least to me it seems that black is much clearer.
> >
> > Is this something that could be incorporated?
> >
> > <2015-05-02_00:05:11.png>
> > ​
> >
> > And the modified code:
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > "protocol: drawing"
> > TRMorph>>drawOn: aCanvas
> >       "aCanvas is a FormCanvas"
> >
> >       self checkSession.
> >
> >       "aCanvas fillRectangle: bounds color: trachelCanvas color."
> >       trachelCanvas playAnimations.
> >
> >       "The drawing has to be done when a change in the shapes occured or when there is an animation."
> >       surface drawDuring: [:cs |
> >               surface clear: trachelCanvas color.
> >
> >               "We display the elements that are subject to the camera"
> >               cs pathTransform
> >                       translateBy: (self extent / 2) asFloatPoint;
> >                           scaleBy: trachelCanvas camera scale asFloat;
> >                       translateBy: trachelCanvas camera position negated asFloatPoint.
> >               trachelCanvas shapes do: [ :trachelShape |
> >                       trachelShape drawOn: cs.
> >               ].
> >
> >               "We display the elements that are _NOT_ subject to the camera"
> >               cs pathTransform loadIdentity scaleBy: 1.001.
> >               trachelCanvas fixedShapes do: [ :trachelShape |
> >                       trachelShape drawOn: cs.
> >               ].
> >       ].
> >
> >       self theme backgroundColor luminance < 0.5 ifTrue: [
> >               surface drawDuring: [ :cs |
> >                       cs paintMode restoreAfter: [
> >                                       cs setPaint: Color white.
> >                                       cs paintMode difference.
> >                                       cs drawShape: (0 @ 0 extent: surface extent)
> >                       ]
> >               ]
> >       ].
> >
> >       "aCanvas translucentImage: surface asForm at: self bounds origin."
> >       "asForm creates a new Form, which is likely to be expensive. This can be cached"
> >       aCanvas image: surface asForm at: self bounds origin sourceRect: (0 @ 0 extent: surface extent) rule: 34.
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > _______________________________________________
> > Moose-dev mailing list
> > [hidden email]
> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

EstebanLM

On 02 May 2015, at 10:05, [hidden email] wrote:


Le 2 mai 2015 09:45, "Esteban Lorenzano" <[hidden email]> a écrit :
>
> nice.
> you will want to use the Idea icon pack with dark theme… experience is highly improved :)

Yes!

I like the exception icons a bit more "different" than "generic blueish". I'll do yellow/orange ones.

sounds good. 
if you contribute it back, I can incorporate it.

Esteban

Phil


>
> Esteban
>
> > On 02 May 2015, at 00:08, Peter Uhnák <[hidden email]> wrote:
> >
> > Hi,
> >
> > since I wanted to use DarkTheme I played around with TRMorph (since seeing giant white rectangle in dark theme is not very nice).
> >
> > What I have done is moved the background color setting to `surface clear:` (instead of the original aCanvas fillRectangle).
> >
> > And then if theme background luminance is dark (>0.5), I invert all the colors in the visualization.
> > For dark theme the background is black, and not the theme background - at least to me it seems that black is much clearer.
> >
> > Is this something that could be incorporated?
> >
> > <2015-05-02_00:05:11.png>
> > ​
> >
> > And the modified code:
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > "protocol: drawing"
> > TRMorph>>drawOn: aCanvas
> >       "aCanvas is a FormCanvas"
> >
> >       self checkSession.
> >
> >       "aCanvas fillRectangle: bounds color: trachelCanvas color."
> >       trachelCanvas playAnimations.
> >
> >       "The drawing has to be done when a change in the shapes occured or when there is an animation."
> >       surface drawDuring: [:cs |
> >               surface clear: trachelCanvas color.
> >
> >               "We display the elements that are subject to the camera"
> >               cs pathTransform
> >                       translateBy: (self extent / 2) asFloatPoint;
> >                           scaleBy: trachelCanvas camera scale asFloat;
> >                       translateBy: trachelCanvas camera position negated asFloatPoint.
> >               trachelCanvas shapes do: [ :trachelShape |
> >                       trachelShape drawOn: cs.
> >               ].
> >
> >               "We display the elements that are _NOT_ subject to the camera"
> >               cs pathTransform loadIdentity scaleBy: 1.001.
> >               trachelCanvas fixedShapes do: [ :trachelShape |
> >                       trachelShape drawOn: cs.
> >               ].
> >       ].
> >
> >       self theme backgroundColor luminance < 0.5 ifTrue: [
> >               surface drawDuring: [ :cs |
> >                       cs paintMode restoreAfter: [
> >                                       cs setPaint: Color white.
> >                                       cs paintMode difference.
> >                                       cs drawShape: (0 @ 0 extent: surface extent)
> >                       ]
> >               ]
> >       ].
> >
> >       "aCanvas translucentImage: surface asForm at: self bounds origin."
> >       "asForm creates a new Form, which is likely to be expensive. This can be cached"
> >       aCanvas image: surface asForm at: self bounds origin sourceRect: (0 @ 0 extent: surface extent) rule: 34.
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > _______________________________________________
> > Moose-dev mailing list
> > [hidden email]
> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

Peter Uhnak
nice.
you will want to use the Idea icon pack with dark theme… experience is highly improved :)
 
Yes, I know, I want to use them. But first priority was to sort out Roassal, as I cannot really Dak Theme without Dark Roassal.
(Also the screenshot is from moose image and there used to be different icon set, so I'll have to check that.)

Peter

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

EstebanLM
In reply to this post by philippeback

On 02 May 2015, at 10:05, [hidden email] wrote:


Le 2 mai 2015 09:45, "Esteban Lorenzano" <[hidden email]> a écrit :
>
> nice.
> you will want to use the Idea icon pack with dark theme… experience is highly improved :)

Yes!

I like the exception icons a bit more "different" than "generic blueish". I'll do yellow/orange oness

too late. 
I made a change. Can you check it to see it that color is ok?

Esteban


Phil


>
> Esteban
>
> > On 02 May 2015, at 00:08, Peter Uhnák <[hidden email]> wrote:
> >
> > Hi,
> >
> > since I wanted to use DarkTheme I played around with TRMorph (since seeing giant white rectangle in dark theme is not very nice).
> >
> > What I have done is moved the background color setting to `surface clear:` (instead of the original aCanvas fillRectangle).
> >
> > And then if theme background luminance is dark (>0.5), I invert all the colors in the visualization.
> > For dark theme the background is black, and not the theme background - at least to me it seems that black is much clearer.
> >
> > Is this something that could be incorporated?
> >
> > <2015-05-02_00:05:11.png>
> > ​
> >
> > And the modified code:
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > "protocol: drawing"
> > TRMorph>>drawOn: aCanvas
> >       "aCanvas is a FormCanvas"
> >
> >       self checkSession.
> >
> >       "aCanvas fillRectangle: bounds color: trachelCanvas color."
> >       trachelCanvas playAnimations.
> >
> >       "The drawing has to be done when a change in the shapes occured or when there is an animation."
> >       surface drawDuring: [:cs |
> >               surface clear: trachelCanvas color.
> >
> >               "We display the elements that are subject to the camera"
> >               cs pathTransform
> >                       translateBy: (self extent / 2) asFloatPoint;
> >                           scaleBy: trachelCanvas camera scale asFloat;
> >                       translateBy: trachelCanvas camera position negated asFloatPoint.
> >               trachelCanvas shapes do: [ :trachelShape |
> >                       trachelShape drawOn: cs.
> >               ].
> >
> >               "We display the elements that are _NOT_ subject to the camera"
> >               cs pathTransform loadIdentity scaleBy: 1.001.
> >               trachelCanvas fixedShapes do: [ :trachelShape |
> >                       trachelShape drawOn: cs.
> >               ].
> >       ].
> >
> >       self theme backgroundColor luminance < 0.5 ifTrue: [
> >               surface drawDuring: [ :cs |
> >                       cs paintMode restoreAfter: [
> >                                       cs setPaint: Color white.
> >                                       cs paintMode difference.
> >                                       cs drawShape: (0 @ 0 extent: surface extent)
> >                       ]
> >               ]
> >       ].
> >
> >       "aCanvas translucentImage: surface asForm at: self bounds origin."
> >       "asForm creates a new Form, which is likely to be expensive. This can be cached"
> >       aCanvas image: surface asForm at: self bounds origin sourceRect: (0 @ 0 extent: surface extent) rule: 34.
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > _______________________________________________
> > Moose-dev mailing list
> > [hidden email]
> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

abergel
In reply to this post by Peter Uhnak
Hi Peter!

What your propose make sense and deserve to be carefully considered.
Instead of modifying TRMorph, maybe we can have an interaction for this?
I am not so keen to modify TRMorph.

Also, there exist some color palette that produce good results when use with a white or black background:
http://ethanschoonover.com/solarized

Cheers,
Alexandre

> Le 1 mai 2015 à 19:08, Peter Uhnák <[hidden email]> a écrit :
>
> Hi,
>
> since I wanted to use DarkTheme I played around with TRMorph (since seeing giant white rectangle in dark theme is not very nice).
>
> What I have done is moved the background color setting to `surface clear:` (instead of the original aCanvas fillRectangle).
>
> And then if theme background luminance is dark (>0.5), I invert all the colors in the visualization.
> For dark theme the background is black, and not the theme background - at least to me it seems that black is much clearer.
>
> Is this something that could be incorporated?
>

>

> ​
>
> And the modified code:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "protocol: drawing"
> TRMorph>>drawOn: aCanvas
> "aCanvas is a FormCanvas"
>
> self checkSession.
>
> "aCanvas fillRectangle: bounds color: trachelCanvas color."
> trachelCanvas playAnimations.
>
> "The drawing has to be done when a change in the shapes occured or when there is an animation."
> surface drawDuring: [:cs |
> surface clear: trachelCanvas color.
>
> "We display the elements that are subject to the camera"
> cs pathTransform
> translateBy: (self extent / 2) asFloatPoint;
>    scaleBy: trachelCanvas camera scale asFloat;
> translateBy: trachelCanvas camera position negated asFloatPoint.
> trachelCanvas shapes do: [ :trachelShape |
> trachelShape drawOn: cs.
> ].
>
> "We display the elements that are _NOT_ subject to the camera"
> cs pathTransform loadIdentity scaleBy: 1.001.
> trachelCanvas fixedShapes do: [ :trachelShape |
> trachelShape drawOn: cs.
> ].
> ].
>
> self theme backgroundColor luminance < 0.5 ifTrue: [
> surface drawDuring: [ :cs |
> cs paintMode restoreAfter: [
> cs setPaint: Color white.
> cs paintMode difference.
> cs drawShape: (0 @ 0 extent: surface extent)
> ]
> ]
> ].
>
> "aCanvas translucentImage: surface asForm at: self bounds origin."
> "asForm creates a new Form, which is likely to be expensive. This can be cached"
> aCanvas image: surface asForm at: self bounds origin sourceRect: (0 @ 0 extent: surface extent) rule: 34.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

2015-05-02_00:05:11.png (440K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

Peter Uhnak
I am aware of solarized, I do use it for terminal; however I don't think that is a good solution here.
I wanted a general solution that would work irrespective of the used colors - so it would for my custom visualizations, as well as roassal examples.

I don't think that this is possible to achieve via interaction, because that would mean overriding every single shape.
So maybe subclassing TRMorph and having TRDarkMorph with overriden drawOn: method? That way the original TRMorph would remain intact and this new dark behavior would be supported.

Peter

On Sat, May 2, 2015 at 12:59 PM, Alexandre Bergel <[hidden email]> wrote:
Hi Peter!

What your propose make sense and deserve to be carefully considered.
Instead of modifying TRMorph, maybe we can have an interaction for this?
I am not so keen to modify TRMorph.

Also, there exist some color palette that produce good results when use with a white or black background:
http://ethanschoonover.com/solarized

Cheers,
Alexandre

> Le 1 mai 2015 à 19:08, Peter Uhnák <[hidden email]> a écrit :
>
> Hi,
>
> since I wanted to use DarkTheme I played around with TRMorph (since seeing giant white rectangle in dark theme is not very nice).
>
> What I have done is moved the background color setting to `surface clear:` (instead of the original aCanvas fillRectangle).
>
> And then if theme background luminance is dark (>0.5), I invert all the colors in the visualization.
> For dark theme the background is black, and not the theme background - at least to me it seems that black is much clearer.
>
> Is this something that could be incorporated?
>

>
> ​
>
> And the modified code:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "protocol: drawing"
> TRMorph>>drawOn: aCanvas
>       "aCanvas is a FormCanvas"
>
>       self checkSession.
>
>       "aCanvas fillRectangle: bounds color: trachelCanvas color."
>       trachelCanvas playAnimations.
>
>       "The drawing has to be done when a change in the shapes occured or when there is an animation."
>       surface drawDuring: [:cs |
>               surface clear: trachelCanvas color.
>
>               "We display the elements that are subject to the camera"
>               cs pathTransform
>                       translateBy: (self extent / 2) asFloatPoint;
>                           scaleBy: trachelCanvas camera scale asFloat;
>                       translateBy: trachelCanvas camera position negated asFloatPoint.
>               trachelCanvas shapes do: [ :trachelShape |
>                       trachelShape drawOn: cs.
>               ].
>
>               "We display the elements that are _NOT_ subject to the camera"
>               cs pathTransform loadIdentity scaleBy: 1.001.
>               trachelCanvas fixedShapes do: [ :trachelShape |
>                       trachelShape drawOn: cs.
>               ].
>       ].
>
>       self theme backgroundColor luminance < 0.5 ifTrue: [
>               surface drawDuring: [ :cs |
>                       cs paintMode restoreAfter: [
>                                       cs setPaint: Color white.
>                                       cs paintMode difference.
>                                       cs drawShape: (0 @ 0 extent: surface extent)
>                       ]
>               ]
>       ].
>
>       "aCanvas translucentImage: surface asForm at: self bounds origin."
>       "asForm creates a new Form, which is likely to be expensive. This can be cached"
>       aCanvas image: surface asForm at: self bounds origin sourceRect: (0 @ 0 extent: surface extent) rule: 34.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

Peter Uhnak
Also, there exist some color palette that produce good results when use with a white or black background:
Not to mention bitmaps.

My point is not to design some general purpose palette, but to allow user of DarkTheme use Roassal without being blinded.

Peter



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

abergel
In reply to this post by Peter Uhnak
> I am aware of solarized, I do use it for terminal; however I don't think that is a good solution here.
> I wanted a general solution that would work irrespective of the used colors - so it would for my custom visualizations, as well as roassal examples.

Ok, I perfectly understand your intent.

> I don't think that this is possible to achieve via interaction, because that would mean overriding every single shape.
> So maybe subclassing TRMorph and having TRDarkMorph with overriden drawOn: method? That way the original TRMorph would remain intact and this new dark behavior would be supported.

Yes, this is a first step.
The only (relevant) references of TRMorph is in TRCanvas >> morphClass. Here are some solutions:
        - We could add a registry. Each subclass of a new TRAbstractMorph has an order, and we use the highest order. In that case, you need to load a package Trachel4DarkTheme whenever you need to use it

        - We could have a method TRCanvas class>>morphClass: aTRMorphClass, and you need to execute “TRCanvas morphClass: TRDarkMorph” before enjoying its benefit. This setting could also be accessible from the Roassal World menu.

Both solution are perfectly feasible. I can work on it. Which one you prefer?

Cheers,
Alexandre

>
> Peter
>
> On Sat, May 2, 2015 at 12:59 PM, Alexandre Bergel <[hidden email]> wrote:
> Hi Peter!
>
> What your propose make sense and deserve to be carefully considered.
> Instead of modifying TRMorph, maybe we can have an interaction for this?
> I am not so keen to modify TRMorph.
>
> Also, there exist some color palette that produce good results when use with a white or black background:
> http://ethanschoonover.com/solarized
>
> Cheers,
> Alexandre
>
> > Le 1 mai 2015 à 19:08, Peter Uhnák <[hidden email]> a écrit :
> >
> > Hi,
> >
> > since I wanted to use DarkTheme I played around with TRMorph (since seeing giant white rectangle in dark theme is not very nice).
> >
> > What I have done is moved the background color setting to `surface clear:` (instead of the original aCanvas fillRectangle).
> >
> > And then if theme background luminance is dark (>0.5), I invert all the colors in the visualization.
> > For dark theme the background is black, and not the theme background - at least to me it seems that black is much clearer.
> >
> > Is this something that could be incorporated?
> >
>
> >
> > ​
> >
> > And the modified code:
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > "protocol: drawing"
> > TRMorph>>drawOn: aCanvas
> >       "aCanvas is a FormCanvas"
> >
> >       self checkSession.
> >
> >       "aCanvas fillRectangle: bounds color: trachelCanvas color."
> >       trachelCanvas playAnimations.
> >
> >       "The drawing has to be done when a change in the shapes occured or when there is an animation."
> >       surface drawDuring: [:cs |
> >               surface clear: trachelCanvas color.
> >
> >               "We display the elements that are subject to the camera"
> >               cs pathTransform
> >                       translateBy: (self extent / 2) asFloatPoint;
> >                           scaleBy: trachelCanvas camera scale asFloat;
> >                       translateBy: trachelCanvas camera position negated asFloatPoint.
> >               trachelCanvas shapes do: [ :trachelShape |
> >                       trachelShape drawOn: cs.
> >               ].
> >
> >               "We display the elements that are _NOT_ subject to the camera"
> >               cs pathTransform loadIdentity scaleBy: 1.001.
> >               trachelCanvas fixedShapes do: [ :trachelShape |
> >                       trachelShape drawOn: cs.
> >               ].
> >       ].
> >
> >       self theme backgroundColor luminance < 0.5 ifTrue: [
> >               surface drawDuring: [ :cs |
> >                       cs paintMode restoreAfter: [
> >                                       cs setPaint: Color white.
> >                                       cs paintMode difference.
> >                                       cs drawShape: (0 @ 0 extent: surface extent)
> >                       ]
> >               ]
> >       ].
> >
> >       "aCanvas translucentImage: surface asForm at: self bounds origin."
> >       "asForm creates a new Form, which is likely to be expensive. This can be cached"
> >       aCanvas image: surface asForm at: self bounds origin sourceRect: (0 @ 0 extent: surface extent) rule: 34.
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > _______________________________________________
> > Moose-dev mailing list
> > [hidden email]
> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

Peter Uhnak

The only (relevant) references of TRMorph is in TRCanvas >> morphClass. Here are some solutions:
        - We could add a registry. Each subclass of a new TRAbstractMorph has an order, and we use the highest order. In that case, you need to load a package Trachel4DarkTheme whenever you need to use it

        - We could have a method TRCanvas class>>morphClass: aTRMorphClass, and you need to execute “TRCanvas morphClass: TRDarkMorph” before enjoying its benefit. This setting could also be accessible from the Roassal World menu.

I was thinking that having a settings option might be more feasible.

Adding a checkbox to settings (Settings > Appearance probably)... "[] use dark Roassal"
this would be also be much easier to change back without the need to unload packages

and then somewhere (TRCanvas probably), on class side similarly to UITheme stored the class(name) in singleton variable. Thus changing the option in settings would just swap TRMorph for TRDarkMorph and vice versa.

To me this feels more versatile and maybe even easier to implement.
What do you think?

Peter

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

abergel
I have noticed that TRCanvas has a color attribute. Does this help to make Mondrian dark-theme friendly?

b := RTMondrian new.
b nodes: (1 to: 20).
b layout grid.
b view canvas color: Color black.
b


Cheers,
Alexandre



On May 3, 2015, at 8:03 PM, Peter Uhnák <[hidden email]> wrote:


The only (relevant) references of TRMorph is in TRCanvas >> morphClass. Here are some solutions:
        - We could add a registry. Each subclass of a new TRAbstractMorph has an order, and we use the highest order. In that case, you need to load a package Trachel4DarkTheme whenever you need to use it

        - We could have a method TRCanvas class>>morphClass: aTRMorphClass, and you need to execute “TRCanvas morphClass: TRDarkMorph” before enjoying its benefit. This setting could also be accessible from the Roassal World menu.

I was thinking that having a settings option might be more feasible.

Adding a checkbox to settings (Settings > Appearance probably)... "[] use dark Roassal"
this would be also be much easier to change back without the need to unload packages

and then somewhere (TRCanvas probably), on class side similarly to UITheme stored the class(name) in singleton variable. Thus changing the option in settings would just swap TRMorph for TRDarkMorph and vice versa.

To me this feels more versatile and maybe even easier to implement.
What do you think?

Peter
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Theme aware-ish TRMorph

Peter Uhnak
As I've wrote in the beginning, merely changing the background wasn't enough for me, and inverting colors was the only way.

As for Mondrian, it would have to act as a color scheme… but I personally don't really use Mondrian so don't ask me. :)

Peter

On Wed, Feb 24, 2016 at 2:01 PM, Alexandre Bergel <[hidden email]> wrote:
I have noticed that TRCanvas has a color attribute. Does this help to make Mondrian dark-theme friendly?

b := RTMondrian new.
b nodes: (1 to: 20).
b layout grid.
b view canvas color: Color black.
b


Cheers,
Alexandre



On May 3, 2015, at 8:03 PM, Peter Uhnák <[hidden email]> wrote:


The only (relevant) references of TRMorph is in TRCanvas >> morphClass. Here are some solutions:
        - We could add a registry. Each subclass of a new TRAbstractMorph has an order, and we use the highest order. In that case, you need to load a package Trachel4DarkTheme whenever you need to use it

        - We could have a method TRCanvas class>>morphClass: aTRMorphClass, and you need to execute “TRCanvas morphClass: TRDarkMorph” before enjoying its benefit. This setting could also be accessible from the Roassal World menu.

I was thinking that having a settings option might be more feasible.

Adding a checkbox to settings (Settings > Appearance probably)... "[] use dark Roassal"
this would be also be much easier to change back without the need to unload packages

and then somewhere (TRCanvas probably), on class side similarly to UITheme stored the class(name) in singleton variable. Thus changing the option in settings would just swap TRMorph for TRDarkMorph and vice versa.

To me this feels more versatile and maybe even easier to implement.
What do you think?

Peter
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev