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

@import '../common';

/*
* 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-coverage: #b3e841;
$dark-no-coverage: #ff4f33;
$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: #8abeb7;
$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
  .file-line-num {
    @include line-number-link($dark-line-num-color);
  }
  
  .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;
  }

  .line_expansion {
    @include diff-expansion($dark-main-bg, $dark-border, $dark-na);
  }

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

    .diff-td.diff-line-num.hll:not(.empty-cell),
    .diff-td.line-coverage.hll:not(.empty-cell),
    .diff-td.line-codequality.hll:not(.empty-cell),
    .diff-td.line_content.hll:not(.empty-cell),
    td.diff-line-num.hll:not(.empty-cell),
    td.line-coverage.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%);
    }

    .line-coverage {
      @include line-coverage-border-color($dark-coverage, $dark-no-coverage);
    }

    .diff-line-num.new,
    .line-coverage.new,
    .line-codequality.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-coverage.old,
    .line-codequality.old,
    .line_content.old {
      @include diff-background($dark-old-bg, $dark-old-idiff, $dark-border);

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

    .diff-grid-left:hover,
    .diff-grid-right:hover {
      .diff-line-num:not(.empty-cell) {
        @include line-number-hover($dark-over-bg);
      }
    }

    .diff-line-num {
      &.is-over,
      &.hll:not(.empty-cell).is-over {
        @include line-number-hover($dark-over-bg);
      }
    }

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

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

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

  @include conflict-colors('dark');

  // 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 { /* Generic.Heading */
    color: $dark-gh;
    font-weight: $gl-font-weight-bold;
  }
  .gi { color: $dark-gi; } /* Generic.Inserted */
  .gp { /* Generic.Prompt */
    color: $dark-gp;
    font-weight: $gl-font-weight-bold;
  }
  .gs { font-weight: $gl-font-weight-bold; } /* Generic.Strong */
  .gu { /* Generic.Subheading */
    color: $dark-gu;
    font-weight: $gl-font-weight-bold;
  }
  .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 */
}
