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

Google Translate plugin dark mode problem #1931

Closed
rxliuli opened this issue Jan 26, 2020 · 10 comments
Closed

Google Translate plugin dark mode problem #1931

rxliuli opened this issue Jan 26, 2020 · 10 comments

Comments

@rxliuli
Copy link

rxliuli commented Jan 26, 2020

image

Using the official Google Translate plugin: https://chrome.google.com/webstore/detail/google-translate/aapbdbdomjkkjkaonfhkkikfgjllcleb

@rxliuli
Copy link
Author

rxliuli commented Jan 26, 2020

Similar to the previous issue #625, but the problem is that the text is difficult to see in dark mode

@chuntangwang
Copy link

Same issue here.

My solution is modifying CSS config .jfk-bubble in Dynamic Theme Editor.

  1. Click extension icon of Dark Reader > More
  2. Check Theme engine is Dynamic by default
  3. Click button Dev Tools.

Default

.jfk-bubble {
    background-color: ${white} !important;
}

Replacing white with dark.

.jfk-bubble {
    background-color: ${dark} !important;
}

then click button Apply.

Maybe it will effect some websites using class .jfk-bubble, but at least it works for me now.

@rxliuli
Copy link
Author

rxliuli commented Jan 31, 2020

Same issue here.

My solution is modifying CSS config .jfk-bubble in Dynamic Theme Editor.

  1. Click extension icon of Dark Reader > More
  2. Check Theme engine is Dynamic by default
  3. Click button Dev Tools.

Default

.jfk-bubble {
    background-color: ${white} !important;
}

Replacing white with dark.

.jfk-bubble {
    background-color: ${dark} !important;
}

then click button Apply.

Maybe it will effect some websites using class .jfk-bubble, but at least it works for me now.

Okay, this did solve my problem, but hopefully the official can give a better solution (dark mode, but a more recognizable way of text)

@FranklinYu
Copy link

Styling things in shadow DOM is very difficult. Maybe we can look at how Stylus team is trying to tackle it: openstyles/stylus#739

@alexanderby
Copy link
Member

alexanderby commented Feb 4, 2020

@FranklinYu Interesting solution, thanks.

Currently I've made a fix here 811cefb

But Chrome Web Store update reviews have become too long, so maybe you could try copying the fix into Dark Reader Dev Tools.

@rxliuli
Copy link
Author

rxliuli commented Feb 4, 2020

@FranklinYu

Currently I've made a fix here 811cefb

But Chrome Web Store update reviews have become too long, so maybe you could try copying the fix into Dark Reader Dev Tools.

Yes this solution does work!

@rxliuli rxliuli closed this as completed Feb 4, 2020
@alexanderby
Copy link
Member

Also there used to be an auto-update of these config files from GitHub, but the GitHub team started to complain about huge amount of traffic.

@rxliuli
Copy link
Author

rxliuli commented Feb 4, 2020

Also there used to be an auto-update of these config files from GitHub, but the GitHub team started to complain about huge amount of traffic.

I think this can be bypassed by CDN + periodic (daily) updates. . .

@rxliuli
Copy link
Author

rxliuli commented Feb 4, 2020

I have done this before (updated once a day), and it looks like there should be no problem at this time. If the number of users is really large, then you can use cdn jsdelivr as a relay. . .

An oil monkey script that does this:https://greasyfork.org/zh-CN/scripts/391193-%E8%A7%A3%E9%99%A4%E7%BD%91%E9%A1%B5%E9%99%90%E5%88%B6

The key code is as follows

  function compatibleAsync(res, callback) {
    return res instanceof Promise ? res.then(callback) : callback(res)
  }

  function onceOfCycle(fn, time) {
    const get = window.GM_getValue
    const set = window.GM_setValue
    const LastUpdateKey = 'LastUpdate'
    const LastValueKey = 'LastValue'
    return new Proxy(fn, {
      apply(_, _this, args) {
        const now = Date.now()
        const last = get(LastUpdateKey)
        if (last !== null && now - last < time) {
          return safeExec(() => JSON.parse(get(LastValueKey)))
        }
        return compatibleAsync(Reflect.apply(_, _this, args), res => {
          set(LastUpdateKey, now)
          set(LastValueKey, JSON.stringify(res))
          return res
        })
      },
    })
  }

@FranklinYu
Copy link

Yes CDN can help. In addition to https://www.jsdelivr.com mentioned above, https://statically.io is another famous option.

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

4 participants