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 alexandre.bergel@me.com 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 i.uhnak@gmail.com 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 Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev