Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not using active syntax theme #5

Closed
batjko opened this issue Jul 14, 2014 · 24 comments

Comments

Projects
None yet
4 participants
@batjko
Copy link

commented Jul 14, 2014

Hi,

This is a great package.
One little issue to note would be that the preview doesn't seem to use the actual syntax theme, in terms of the font and colors:
image

Any chance this can be adopted?

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 14, 2014

Any chance this can be adopted?

Absolutely. I originally tried to get https://github.com/atom/highlights working however it complained with errors when I installed it so I used another package, see #1. Maybe @kevinsawicki could give me a hand in where I should look for how the EditorView renders syntax highlighting :).

@kevinsawicki

This comment has been minimized.

Copy link

commented Jul 14, 2014

There is an API on the EditorView to build HTML for a given text chunk using the current theme.

The Markdown preview package uses it to colorize code blocks in markdown files.

You can get the JS grammar by doing atom.syntax.grammarForScopeName('source.js') and then do the following to build the HTML: https://github.com/atom/markdown-preview/blob/17dd86ede2d6a270fecc39b696282937c67fb3ae/lib/renderer.coffee#L97-L100

Is this what you are looking for?

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 14, 2014

Looks like exactly what I need! Thank you @kevinsawicki!
I should be able to whip this up quickly later tonight :).

@kevinsawicki

This comment has been minimized.

Copy link

commented Jul 14, 2014

Great, let me know if you have any issues, very cool package 👍

@batjko

This comment has been minimized.

Copy link
Author

commented Jul 14, 2014

Great stuff! Thank you both.

@Glavin001 Glavin001 added bug labels Jul 14, 2014

@Glavin001 Glavin001 self-assigned this Jul 14, 2014

@Glavin001 Glavin001 closed this in 433d578 Jul 14, 2014

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 14, 2014

Pushed :).
screenshot

@batjko

This comment has been minimized.

Copy link
Author

commented Jul 14, 2014

Yup, that looks pretty now!

The font size isn't catching up yet, but the theme is working very nicely now!
image

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 14, 2014

Whaaat? I even fixed the font-size before I pushed. It updates the font-size every time it renders the new preview.
https://github.com/Glavin001/atom-coffeescript-preview/blob/master/lib/coffeescript-preview-view.coffee#L135-L141

@kevinsawicki any ideas / alternatives to syncing the font-size?

@batjko

This comment has been minimized.

Copy link
Author

commented Jul 14, 2014

Sorry, mate.
I tried closing the preview, then changing the coffee's size, then re-loading the preview, still not adapting.

No errors in the console, btw.

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 14, 2014

Just tried it with mine. It is working, because the tab change event is triggered when I got back from Atom Settings tab back to the coffeescript editor, and it reloads the view and re-applies the font-size.

How are you setting the font size?

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 14, 2014

@batjko I think I may have found the problem. And also a solution. Continuing with issue #6

@batjko

This comment has been minimized.

Copy link
Author

commented Jul 14, 2014

Ah, yea I'm not using the settings view for it, rather the Ctrl+= and Ctrl+- key binding for adjusting the size.
But even changing it in the Settings View doesn't do it for the preview.

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 14, 2014

@batjko I have pushed and published a patch that fixes the issues you described and I tested with Ctrl+= and Ctrl+- key binding for adjusting the size. Hope it works well for you, too :).

@batjko

This comment has been minimized.

Copy link
Author

commented Jul 14, 2014

Yup, now it changes font size as I change it. Purrs like a kitten!
Well done, and thanks for the quick turn-around!

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 14, 2014

You're very welcome! Thank you for your support and let me know if you have any other ideas to make it even better!

@daniocean

This comment has been minimized.

Copy link

commented Jul 24, 2014

Hi guys, this works fine for the inbuilt themes of Atom, but when trying something different (Monokai) it just shows grey text. Any idea where the problem might be?

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 24, 2014

@daniocean, like this?
image

@daniocean

This comment has been minimized.

Copy link

commented Jul 24, 2014

Yes, exactly :)

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 24, 2014

I have been using the editor-colors class, and these other themes that are not working appear to be just using editor with editor-colors. However, it could also be an issue with the latest Atom updates -- I am finding that the font-size is also incorrectly rendered now even though the CSS says font-size: 16px for both.

image

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 24, 2014

Tested Themes:

  • Atom Dark
  • Base16
  • Monokai
  • Solarized Dark

Glavin001 added a commit that referenced this issue Jul 24, 2014

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 24, 2014

@daniocean just published a patch. Let me know if it works for you as well.

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 24, 2014

Also, I recommend everyone slowly migrates over to using https://github.com/Glavin001/atom-preview :).

@daniocean

This comment has been minimized.

Copy link

commented Jul 24, 2014

Works great, thanks!

I'll probably move to "preview" as soon as this fix is in it :)

Cheers!

@Glavin001

This comment has been minimized.

Copy link
Owner

commented Jul 24, 2014

Excellent!

Sounds good. I'll have to make the fix on Preview later tonight after work.

Continued development will likely only continue on with Preview and deprecate CoffeeScript-Preview very soon.

Thanks for your support! Enjoy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.