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

Please add a dark mode to the Typescript Playground for better accessibilty #90

Closed
nisarhassan12 opened this issue Oct 18, 2019 · 12 comments
Labels
Playground Issues that affect the Playground

Comments

@nisarhassan12
Copy link

Currently, the Typescript playground , is not much comfortable as it only has a white theme For someone like me with a low vision

image

It would be nice if there is a dark mode for the playground.

@orta orta transferred this issue from microsoft/TypeScript Oct 18, 2019
@orta
Copy link
Contributor

orta commented Oct 18, 2019

Moved to the website repo, and it will get one when the new site gets dark mode too. If you'd like to see it before then, feel free to submit a PR 👍

@orta orta added the Playground Issues that affect the Playground label Oct 18, 2019
@nisarhassan12
Copy link
Author

nisarhassan12 commented Oct 20, 2019

Thanks! a bunch @orta. I'm Junior Front-end Developer would love to make a PR but not sure whether my skillset is ok for this but I will try anyway to make it happen 🙂

@orta orta mentioned this issue Oct 23, 2019
11 tasks
@nisarhassan12
Copy link
Author

I'm so Sorry! @orta I have got busy in other things so I can't make the PR.

@orta
Copy link
Contributor

orta commented Nov 1, 2019

Never feel guilty for not contributing to open source

@nisarhassan12
Copy link
Author

Never feel guilty for not contributing to open source

Thanks! a bunch! 🙂 ❤️

@keithlayne
Copy link

So, instead of constantly trolling @orta about this feature, I figured I should just implement it. The implementation is super easy, but probably need some questions answered before actually doing it.

Currently there's a single theme defined and used in main-2.js. That's all there is to it.

Monaco comes with (AFAICT) 3 built-in themes: vs, vs-dark, and hc-black. Changing the editor theme is as simple as i.e. monaco.editor.setTheme("vs-dark"). BUT, looks like Orta used 'vs' (the built-in light theme) as a basis for the playground theme, which makes me think it would not be desirable to just plug in one of the other two.

So, questions:

  1. Would it be okay to use those as-is, at least for a first pass?
  2. The other two don't jive too well with the overall theme and branding of the site - should there be changes in the non-editor css when the editor theme changes?
  3. I was thinking vscode shipped with more themes (i.e. Solarized) - should this just be a light/dark/HC option, or maybe include at least the default vscode themes for user pleasure? I was thinking of just writing a script to scrape the relevant stuff right out of the vscode repo. Seems like low-hanging fruit, but may not be valuable.
  4. Should the theme choice be persisted? If so, how? I think of this as a user preference, i.e. not something that should be reflected in the URL.
  5. How do you wanna reflect this in the UI? I was thinking a dropdown on the right side near 'About' named 'Theme' or 'Editor Theme'. I'm an amazing UI designer 🚎

With some guidance on these things, I can turn this around quickly...let me know!

@keithlayne
Copy link

Ummmm...is orta/typescript-play even relevant? Now I feel dumb.

@orta
Copy link
Contributor

orta commented Nov 4, 2019

orta/typescript-play even relevant

Yep, it's used as a sub-module in this repo.

Would it be okay to use those as-is, at least for a first pass?

Yes

  • You can't easily use a vscode theme in monaco (vscode has a theming engine which doesn't run in monaco solo) so I'd make it from scratch. Honestly though, if you get 90% there I'll wrap that up and make it consistent etc. Look here instead for ideas but IMO write it yourself so that we don't have to think about licensing.

  • I'd persist it in local storage (we do that for your query) which should be fine IMO

  • Yeah, lets start with a dropdown like themes. The site uses bootstrap 3 so you can use these docs to make a dropdown. Theme is fine and a list of options is cool, I'll eventually move it out into the site selector, so please don't offer more than a dark and a high contrast or else they'll get removed later and folks will be sad

@keithlayne
Copy link

I'm a little confused. Are you saying that setTheme('vs-dark') won't work? Seemed to when I ran it locally. Especially since there's the base property.

No biggie, I can do pretty much all of this without a lot of specifics on the theme, so I'll get something for you to look at ASAP.

@orta
Copy link
Contributor

orta commented Nov 4, 2019

too cool for defaults

keithlayne added a commit to keithlayne/typescript-play that referenced this issue Nov 5, 2019
This adds a new 'Theme' dropdown menu to the playground. Themes include:

- light (current playground theme)
- dark
- dark with high contrast

On load all themes are registered, and them localStorage is checked for
any saved theme, defaulting to 'light'.  Updates store the last selected
theme in localStorage.

Related: microsoft/TypeScript-Website#90
@keithlayne
Copy link

Should this be closed for now or stay open for the eventual v2 implementation?

@orta
Copy link
Contributor

orta commented Nov 7, 2019

Nah, this is enough IMO

@orta orta closed this as completed Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Playground Issues that affect the Playground
Projects
None yet
Development

No branches or pull requests

3 participants