qrm2 icon indicating copy to clipboard operation
qrm2 copied to clipboard

Tex command: colour inversion

Open classabbyamp opened this issue 4 years ago • 7 comments

https://github.com/miaowware/qrm2/pull/371#issuecomment-803751682

classabbyamp avatar Mar 22 '21 05:03 classabbyamp

I can already say that PIL is not going to be nice at all.

Aliasing will be an issue, but so will be PIL's tremendous slowness (blocking in the breaks-the-loop sense)

0x5c avatar Mar 22 '21 09:03 0x5c

rtex supports pdf output. maybe there could be some pdf -> svg -> png conversion in there? sounds somewhat cursed tho

classabbyamp avatar Mar 23 '21 04:03 classabbyamp

Is styling just not supported by the renderer?

0x5c avatar Mar 23 '21 16:03 0x5c

it can be done in the latex, but that can mess up some of the styling people input. would be interesting to see how mathbot does it.

@thxo do you know of any way to invert the document in latex?

classabbyamp avatar Mar 23 '21 16:03 classabbyamp

The easiest way is probably just manually setting the page and text colours to something dark and something light, respectively:

sample tikz graphic and equation under a dark background

I did some experimenting and it looks like tikz follows the text colour as well. It is not perfect in all situations (e.g., if we get a manually selected dark blue, we can't invert that color when the page turns dark to make it light), but it works for most cases.

thxo avatar Mar 23 '21 21:03 thxo

well I guess that's the same issue if someone manually selects white for something on a white background.

I suggest adding a second template with dark discord background (#2C2F33) and white default (#FFFFFF) foreground to qrm-resources (e.g. template_dark.#.tex) and a config switch to switch between the two.

(maybe a flag on the command too?)

classabbyamp avatar Mar 23 '21 22:03 classabbyamp

Might be starting to feature creep a bit Since the goal is not typesetting papers on the bot, I think it's safe to assume that colour styling won't be needed much, and that fg #fff and bg #2c2f33 is perfectly fine for the application

We could also aim for the background to match the one of embeds, but there's also that desktop/android/ios versions of discord don't agree on background colour

0x5c avatar Mar 24 '21 07:03 0x5c