romannurik / SlidesCodeHighlighter

A little web app that helps you copy+paste syntax-highlighted code into slide decks.
https://romannurik.github.io/SlidesCodeHighlighter/
Apache License 2.0
1.06k stars 92 forks source link

Possible background color mismatch #3

Closed ythecombinator closed 6 years ago

ythecombinator commented 7 years ago

First of all, congrats for the amazing project 🎆–I've been really looking for something like this!

I wonder if maybe what I'm reporting here isn't a mistake of mine-then please point and I'll close the issue ASAP 😄 .

What happens is: the formatted code snippets I get seem to always bring a white background with them.

This becomes imperceptible if we choose to use one of the light themes (Light or Light (alternate)) combined with a #ffffff deck background, e.g.

This:

captura de tela 2017-01-14 as 21 04 00

Becomes this:

captura de tela 2017-01-14 as 21 05 10

But if we get to change the deck background color, we can notice my point:

captura de tela 2017-01-14 as 21 08 10

If we end up choosing a dark one (Dark, Dark (alternate) or Dark (design))–even if we set the deck background color to the matching one–, we can also notice:

This (Dark (design))

captura de tela 2017-01-14 as 21 13 02

Becomes this–even though I have set the background color of the slide to #263238:

captura de tela 2017-01-14 as 21 13 06

I'm following the recommendations and using Safari + Keynote. Any thoughts?

romannurik commented 7 years ago

Hm, can you share which versions of Safari, Keynote, and OSX you're running. Also are you clicking once in the right pane (automatically selects the text) and then pressing Cmd+C? Clipboard handling is a little tricky across browsers, so I'd imagine there are some cases where there's extra or not enough data being copied to the clipboard.

ythecombinator commented 7 years ago

Hm, can you share which versions of Safari, Keynote, and OSX you're running.

Here's my setup:

Also are you clicking once in the right pane (automatically selects the text) and then pressing Cmd+C?

Yes. Shouldn't I?

Clipboard handling is a little tricky across browsers, so I'd imagine there are some cases where there's extra or not enough data being copied to the clipboard.

I agree with you and I confess I haven't looked at the source yet to see what you're using for clipboard handling. Is it clipboard.js or something like this?

Thanks for the quick feedback btw.

romannurik commented 7 years ago

Ah, I haven't tested with Keynote 7 and Sierra (I'm using 6.6 and El Capitan). Hopefully can test soon. In the meantime, you may need to manually reset it. There actually is some code in the tool that attempts to prevent the background color from being copied; my guess is Sierra/Safari/Keynote7 are doing something differently with clipboard contents than previous versions :-/

ythecombinator commented 7 years ago

my guess is Sierra/Safari/Keynote7 are doing something differently with clipboard contents than previous versions :-/

If I get to figure out what happens, Imma surely send a PR 😄

Thank you for your attention.

jelbourn commented 7 years ago

I've also run into this issue w/ Chrome on Linux plus Google Slides. Seems like it can be solved by applying background: transparent to the <pre> element.

aried3r commented 7 years ago

I just tried with: macOS Sierra 10.12.4 Keynote 7.1

These are the results, I did not change the fonts, this is the result after simply copy pasting.

Safari 10.1

screen shot 2017-04-14 at 13 30 08

Chrome 57

screen shot 2017-04-14 at 13 35 12

romannurik commented 7 years ago

Safari still broken but Chrome may not look right because you don't have Roboto Mono installed?

aried3r commented 7 years ago

Oh my 🙈, I didn't notice I never installed the Mono variant. That did indeed solve it for Chrome!

Thanks for the project, I'm currently writing my first Keynote presentation ever, it's a big time saver.

aried3r commented 7 years ago

I haven't looked into the differences yet, but it seems to work with http://markup.su/highlighter/, regarding the background color at least.