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

Custom css-file #12

Open
KaffeMyers opened this issue Sep 5, 2019 · 1 comment
Open

Custom css-file #12

KaffeMyers opened this issue Sep 5, 2019 · 1 comment

Comments

@KaffeMyers
Copy link

Hi,
I wanted another slack style, so sloppily amended the script as such:

  case "$1" in
    --revert)
      REVERT=true
      shift
      ;;
    *) CSSstyle="$1"
      shift
      ;;
  esac
done


[[ -z $CSSstyle ]] && CSSstyle=https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css

JS_START="// First make sure the wrapper app is loaded"

JS="
${JS_START}
document.addEventListener('DOMContentLoaded', function() {
  // Fetch our CSS in parallel ahead of time
  const cssPath = '$CSSstyle';
  let cssPromise = fetch(cssPath).then((response) => response.text());

Maybe something similar can be added to the "official version" to support other custom css styles.

@l10nelw
Copy link

l10nelw commented Sep 8, 2019

Is there a reason why the css can't be in a local file? Trying to understand.

I tried the following in the script, didn't work:

CSS=$(<my-custom.css)
JS="
document.addEventListener('DOMContentLoaded', function() {
  // Insert a style tag into the wrapper view
  let s = document.createElement('style');
  s.type = 'text/css';
  s.innerHTML = `${CSS}`;
  document.head.appendChild(s);
});"

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

2 participants