spdegabrielle
2020-7-20 11:06:04

question from @evyatar2013 : > Correct me if I’m wrong, but I couldn’t find a direct way to play with the font of individual characters - so making the raindbow brackets in drracket would require more clever scripting on my part


laurent.orseau
2020-7-20 11:18:59

Yeah, the easiest way to try it out would be in slideshow or metapict. But in any case I was merely joking—I don’t expect it to be clear to read and won’t even scale to more than 3 or 4 levels anyway.


spdegabrielle
2020-7-20 12:31:55

I think @evyatar2013 is after a way to access the colourer from quickscript but it is not clear to me that is possible without changing the colourer


laurent.orseau
2020-7-20 12:43:00

Oh, I misread a little, I was thinking of the sine brackets :face_with_rolling_eyes:

The colorer is a very different beast, I’m not even sure a full DrRacket plugin can tweak it directly.The closest I could find is (<file:///usr/share/racket-7.7.0.4/doc/framework/Color.html?q=font-color#%28def._%28%28lib._framework%2Fmain..rkt%29._color~3aget-parenthesis-colors-table%29%29\|color:get-parenthesis-colors-table>)


laurent.orseau
2020-7-20 12:43:12

but it’s only for reading, no writing.


spdegabrielle
2020-7-20 12:46:35

Yes the colourer is on my todo list for adding hyperlinks to embedded links but I’m wondering if I can add a hook to it so it can be called by plugins/quickscript ?


laurent.orseau
2020-7-20 12:47:40

@evyatar2013 At least you can highlight portions of the text with a chosen color. For example this script highlight the selection in yellow: #lang racket (require quickscript) (define-script highlight #:label "highlight" (λ (selection #:editor ed) (send ed highlight-range (send ed get-start-position) (send ed get-end-position) "yellow") #f))


laurent.orseau
2020-7-20 12:49:45

There are also a few methods to navigate s-expressions (I can dig them up if you want)


laurent.orseau
2020-7-20 12:50:16

But changing the colors of parenthesis as they are being type would need to change the colorer itself, which I think is not plugin-friendly yet.


laurent.orseau
2020-7-20 12:50:31

Maybe @robby would have a better idea though


robby
2020-7-20 12:50:34

@robby has joined the channel


laurent.orseau
2020-7-20 12:54:46

You could have a keyboard shortcut bound to your script that rehighlights all the parenthesis of the previous s-exp for example


robby
2020-7-20 13:05:39

You would need to interact with the colorer, yes, and either override methods (which I guess you cannot do with quickscript) or maybe better would just be to add that functionality to DrRacket via a pull request to racket/gui!


robby
2020-7-20 13:06:05

There is something like it; you can get the subranges inside in different shades or grey or blue via the preferences dialog.


laurent.orseau
2020-7-20 13:08:05

Which methods would need to be overwritten? I’m planning to add hooks in Quickscript at some point


robby
2020-7-20 13:08:19

I’m not sure.


robby
2020-7-20 13:09:03

For rainbow parentheses I guess a script isn’t the thing to do first. Probably first is to support rainbow parentheses in the colorer and then add hooks to that a script can do things like change the set of colors


spdegabrielle
2020-7-20 13:53:11

Gonna look this up