/* https://github.com/MozMorris/tomorrow-pygments */

/*
* Dark syntax colors
*/
$dark-new-bg: rgba(51, 255, 51, 0.1);
$dark-new-idiff: rgba(51, 255, 51, 0.2);
$dark-old-bg: rgba(255, 51, 51, 0.2);
$dark-old-idiff: rgba(255, 51, 51, 0.25);
$dark-border: #808080;
$dark-code-border: #666;
$dark-main-bg: #1d1f21;
$dark-main-color: #1d1f21;
$dark-line-color: #c5c8c6;
$dark-line-num-color: rgba(255, 255, 255, 0.3);
$dark-line-num-color-new: #627165;
$dark-line-num-color-old: #806565;
$dark-diff-not-empty-bg: #557;
$dark-highlight-bg: #ffe792;
$dark-highlight-color: $black;
$dark-pre-hll-bg: #373b41;
$dark-hll-bg: #373b41;
$dark-over-bg: #9f9ab5;
$dark-expanded-bg: #3e3e3e;
$dark-c: #969896;
$dark-err: #c66;
$dark-k: #b294bb;
$dark-l: #de935f;
$dark-n: #c5c8c6;
$dark-o: #8abeb7;
$dark-p: #c5c8c6;
$dark-cm: #969896;
$dark-cp: #969896;
$dark-c1: #969896;
$dark-cs: #969896;
$dark-gd: #c66;
$dark-gh: #c5c8c6;
$dark-gi: #b5bd68;
$dark-gp: #969896;
$dark-gu: #8abeb7;
$dark-kc: #b294bb;
$dark-kd: #b294bb;
$dark-kn: #8abeb7;
$dark-kp: #b294bb;
$dark-kr: #b294bb;
$dark-kt: #f0c674;
$dark-ld: #b5bd68;
$dark-m: #de935f;
$dark-s: #b5bd68;
$dark-na: #81a2be;
$dark-nb: #c5c8c6;
$dark-nc: #f0c674;
$dark-no: #c66;
$dark-nd: #8abeb7;
$dark-ni: #c5c8c6;
$dark-ne: #c66;
$dark-nf: #81a2be;
$dark-nl: #c5c8c6;
$dark-nn: #f0c674;
$dark-nx: #81a2be;
$dark-py: #c5c8c6;
$dark-nt: #8abeb7;
$dark-nv: #c66;
$dark-ow: #8abeb7;
$dark-w: #c5c8c6;
$dark-mf: #de935f;
$dark-mh: #de935f;
$dark-mi: #de935f;
$dark-mo: #de935f;
$dark-sb: #b5bd68;
$dark-sc: #c5c8c6;
$dark-sd: #969896;
$dark-s2: #b5bd68;
$dark-se: #de935f;
$dark-sh: #b5bd68;
$dark-si: #de935f;
$dark-sx: #b5bd68;
$dark-sr: #b5bd68;
$dark-s1: #b5bd68;
$dark-ss: #b5bd68;
$dark-bp: #c5c8c6;
$dark-vc: #c66;
$dark-vg: #c66;
$dark-vi: #c66;
$dark-il: #de935f;

.code.dark {
  // Line numbers
  .line-numbers,
  .diff-line-num {
    background-color: $dark-main-bg;
  }

  .diff-line-num,
  .diff-line-num a {
    color: $dark-line-num-color;
  }

  // Code itself
  pre.code,
  .diff-line-num {
    border-color: $dark-code-border;
  }

  &,
  pre.code,
  .line_holder .line_content {
    background-color: $dark-main-bg;
    color: $dark-line-color;
  }

  // Diff line
  .line_holder {
    &.match .line_content {
      @include dark-diff-match-line;
    }

    td.diff-line-num.hll:not(.empty-cell),
    td.line_content.hll:not(.empty-cell) {
      background-color: $dark-diff-not-empty-bg;
      border-color: darken($dark-diff-not-empty-bg, 15%);
    }

    .diff-line-num.new,
    .line_content.new {
      @include diff_background($dark-new-bg, $dark-new-idiff, $dark-border);

      &::before,
      a {
        color: $dark-line-num-color-new;
      }
    }

    .diff-line-num.old,
    .line_content.old {
      @include diff_background($dark-old-bg, $dark-old-idiff, $dark-border);

      &::before,
      a {
        color: $dark-line-num-color-old;
      }
    }

    .diff-line-num {
      &.is-over,
      &.hll:not(.empty-cell).is-over {
        background-color: $dark-over-bg;
        border-color: darken($dark-over-bg, 5%);

        a {
          color: darken($dark-over-bg, 15%);
        }
      }
    }

    .line_content.match {
      @include dark-diff-match-line;
    }

    &:not(.diff-expanded) + .diff-expanded,
    &.diff-expanded + .line_holder:not(.diff-expanded) {
      > .diff-line-num,
      > .line_content {
        border-top: 1px solid $black;
      }
    }

    &.diff-expanded {
      > .diff-line-num,
      > .line_content {
        background: $dark-expanded-bg;
        border-color: $dark-expanded-bg;
      }
    }
  }

  // highlight line via anchor
  pre .hll {
    background-color: $dark-pre-hll-bg !important;
  }

  // Search result highlight
  span.highlight_word {
    background-color: $dark-highlight-bg !important;
    color: $dark-highlight-color !important;
  }

  // Links to URLs, emails, or dependencies
  .line a {
    color: $dark-na;
  }

  .hll { background-color: $dark-hll-bg; }
  .c { color: $dark-c; } /* Comment */
  .err { color: $dark-err; } /* Error */
  .k { color: $dark-k; } /* Keyword */
  .l { color: $dark-l; } /* Literal */
  .n { color: $dark-n; } /* Name */
  .o { color: $dark-o; } /* Operator */
  .p { color: $dark-p; } /* Punctuation */
  .cm { color: $dark-cm; } /* Comment.Multiline */
  .cp { color: $dark-cp; } /* Comment.Preproc */
  .c1 { color: $dark-c1; } /* Comment.Single */
  .cs { color: $dark-cs; } /* Comment.Special */
  .gd { color: $dark-gd; } /* Generic.Deleted */
  .ge { font-style: italic; } /* Generic.Emph */
  .gh { color: $dark-gh; font-weight: bold; } /* Generic.Heading */
  .gi { color: $dark-gi; } /* Generic.Inserted */
  .gp { color: $dark-gp; font-weight: bold; } /* Generic.Prompt */
  .gs { font-weight: bold; } /* Generic.Strong */
  .gu { color: $dark-gu; font-weight: bold; } /* Generic.Subheading */
  .kc { color: $dark-kc; } /* Keyword.Constant */
  .kd { color: $dark-kd; } /* Keyword.Declaration */
  .kn { color: $dark-kn; } /* Keyword.Namespace */
  .kp { color: $dark-kp; } /* Keyword.Pseudo */
  .kr { color: $dark-kr; } /* Keyword.Reserved */
  .kt { color: $dark-kt; } /* Keyword.Type */
  .ld { color: $dark-ld; } /* Literal.Date */
  .m { color: $dark-m; } /* Literal.Number */
  .s { color: $dark-s; } /* Literal.String */
  .na { color: $dark-na; } /* Name.Attribute */
  .nb { color: $dark-nb; } /* Name.Builtin */
  .nc { color: $dark-nc; } /* Name.Class */
  .no { color: $dark-no; } /* Name.Constant */
  .nd { color: $dark-nd; } /* Name.Decorator */
  .ni { color: $dark-ni; } /* Name.Entity */
  .ne { color: $dark-ne; } /* Name.Exception */
  .nf { color: $dark-nf; } /* Name.Function */
  .nl { color: $dark-nl; } /* Name.Label */
  .nn { color: $dark-nn; } /* Name.Namespace */
  .nx { color: $dark-nx; } /* Name.Other */
  .py { color: $dark-py; } /* Name.Property */
  .nt { color: $dark-nt; } /* Name.Tag */
  .nv { color: $dark-nv; } /* Name.Variable */
  .ow { color: $dark-ow; } /* Operator.Word */
  .w { color: $dark-w; } /* Text.Whitespace */
  .mf { color: $dark-mf; } /* Literal.Number.Float */
  .mh { color: $dark-mh; } /* Literal.Number.Hex */
  .mi { color: $dark-mi; } /* Literal.Number.Integer */
  .mo { color: $dark-mo; } /* Literal.Number.Oct */
  .sb { color: $dark-sb; } /* Literal.String.Backtick */
  .sc { color: $dark-sc; } /* Literal.String.Char */
  .sd { color: $dark-sd; } /* Literal.String.Doc */
  .s2 { color: $dark-s2; } /* Literal.String.Double */
  .se { color: $dark-se; } /* Literal.String.Escape */
  .sh { color: $dark-sh; } /* Literal.String.Heredoc */
  .si { color: $dark-si; } /* Literal.String.Interpol */
  .sx { color: $dark-sx; } /* Literal.String.Other */
  .sr { color: $dark-sr; } /* Literal.String.Regex */
  .s1 { color: $dark-s1; } /* Literal.String.Single */
  .ss { color: $dark-ss; } /* Literal.String.Symbol */
  .bp { color: $dark-bp; } /* Name.Builtin.Pseudo */
  .vc { color: $dark-vc; } /* Name.Variable.Class */
  .vg { color: $dark-vg; } /* Name.Variable.Global */
  .vi { color: $dark-vi; } /* Name.Variable.Instance */
  .il { color: $dark-il; } /* Literal.Number.Integer.Long */
}
