[Newbies] Browser button decoration colors

christoph.thiede at student.hpi.uni-potsdam.de christoph.thiede at student.hpi.uni-potsdam.de
Sun Dec 4 15:22:23 UTC 2022


Hi Pete,

very nice, thanks for your contribution! :-)

Note that there are multiple color themes in Squeak, which you can select from the world main docking bar under Extras > Themes & Colors. I assume that you are using one of the dark themes. That was a good catch, without your patch the inheritance button looks terrible in the dark themes. However, in the light themes (e.g., the default Squeak theme), the text is now harder to read with your patch.

I think the choice of the right color should be delegated to the UserInterfaceTheme so we can have different button colors for each theme. For a very similar example, take a look at the TestRunner (available from the Tools menu) and it's colored status pane. See TestRunner>>#statusColor and all the senders of, e.g., #passColor for its implementation. Do you feel like making the same change for the inheritance button by adding properties #inheritanceButtonColorHasOverride, #inheritanceButtonColorIsOverrideAndSendsSuper, etc. for #CodeHolder to all UI themes? :-)

> also not sure how to share this…apologies…I’m a newbie to smalltalk

No problem, we are always glad about new contributors! :-) If you are using Squeak Trunk (which is generally recommended if you would like to get involved into Squeak development), you can find a brand new short tutorial on "How to Contribute to Squeak" in the help menu in the docking bar. As your proposed change would affect multiple packages if you follow my suggestion from above (both the Tools package for the change in CodeHolder, and the System package for the change in the UI themes), I think it would be best if you could create a change set and send it to the ist. This process is described in the "Advanced" section of the "Contribution to Squeak" tutorial. If you haven't met the change sorter tool so far or would like to learn more about it, there is also a section about it in the book "Squeak by Example" [1].

Hope that wasn't too much text, and I'm looking forward to your reply! And if you have any further questions, do not hesitate to ask them. :-)

Best,
Christoph

[1] https://github.com/hpi-swa-lab/SqueakByExample-english/releases/download/5.3.1/SBE-5.3.pdf

---
Sent from Squeak Inbox Talk

On 2022-12-03T13:00:47-08:00, ppadilcdx at gmail.com wrote:

> I changed the system browser inheritance button decoration colors as the button label is yellow and with the colors I couldn’t read the button label, which was annoying (my OCD showing).  Not sure if this is of any use to others but here is the code (also not sure how to share this…apologies…I’m a newbie to smalltalk).
> 
> CodeHolder >> inheritanceButtonColor
>     "Check to see if the currently-viewed method has a super send or an override, and if so, change screen feedback, unless the #decorateBrowserButtons says not to."
> 
>     | flags aColor cm defaultButtonColor |
>     defaultButtonColor := (UserInterfaceTheme current get: #color for: #PluggableButtonMorph) ifNil: [Color gray: 0.91].
>     cm := currentCompiledMethod.
>     ((cm isKindOf: CompiledMethod) and: [Preferences decorateBrowserButtons])
>         ifFalse: [^ defaultButtonColor].
> 
>     "This table duplicates the old logic, but adds two new colors for the cases where there is a superclass definition, but this method doesn't call it."
> 
>     flags := 0.
>     self isThisAnOverride ifTrue: [ flags := flags bitOr: 4 ].
>     cm sendsToSuper ifTrue: [ flags := flags bitOr: 2 ].
>     self isThereAnOverride ifTrue: [ flags := flags bitOr: 1 ].
>     aColor := {
>         defaultButtonColor.
>         Color tan muchDarker.
>         Color green muchDarker.
>         Color blue muchDarker.
>         Color red muchDarker.    "has super but doesn't call it"
>         (Color r: 0.74 g: 0.523 b: 0.573).    "has sub; has super but doesn't call it"
>         Color green muchDarker.
>         Color blue muchDarker.
>     } at: flags + 1.
> 
>     ^aColor
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20221204/fadec079/attachment.html>


More information about the Beginners mailing list