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

Code block on dark mode is weird (macOS and iOS) #14

Open
hologerry opened this issue Sep 19, 2019 · 3 comments
Open

Code block on dark mode is weird (macOS and iOS) #14

hologerry opened this issue Sep 19, 2019 · 3 comments

Comments

@hologerry
Copy link

hologerry commented Sep 19, 2019

Screen Shot 2019-09-23 at 19 50 54

@hologerry hologerry changed the title Code block on dark mode is weird Code block on dark mode is weird (macOS and iOS) Sep 23, 2019
@suvernev-d
Copy link

Have the same issue.

Problem seems to be that pygments inserts color codes directly in <span> tags, so there's no easy way to apply different CSS on them. It differs from how (now defunct) Power Format Pack used to work: by wrapping code elements in divs with classes.

So for now I just added alpha to background color of codehilite class directly in pygments style:

# Anki2/addons21/1030875226/pygments/styles/<name of your style from addon config, I use Monokai>

class MonokaiStyle(Style):
    """
    This style mimics the Monokai color scheme.
    """

    background_color = "#ffffff00" # <-- Zeroes for alpha in background
    highlight_color = "#49483e"

Though other colors still look not so good in dark mode

@josh-works
Copy link

It took me a bit of digging to figure out how to implement @suvernev-d's suggestion.

Here's how to implement his suggestion:

  1. In Anki, go to Tools > Addons

  2. Select the Auto Markdown package and click the Config button

  3. In the following object, make sure that colorScheme is set to monokai. (I also turned off lineNums.
    2020-04-14 at 8 51 AM

  4. Click OK.

  5. The modal window will go away, you should be back on the Tools > Addons window.
    Click the View Files button.

  6. Open up the pygments/styles directory, and open monokai.py in your text editor:
    2020-04-14 at 8 44 AM

  7. On line 23, change the value for background_color from #272822 to #ffffff00, per @suvernev-d's comment.

Restart Anki, and try using Markdown!

2020-04-14 at 8 52 AM

@hologerry
Copy link
Author

@josh-works Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants