Improve syntax highlighting styles

Replace hardcoded hex values with Sass variables in [Base16](http://chriskempson.com/projects/base16/)
This commit is contained in:
Michael Rose 2018-01-05 14:54:51 -05:00
parent 0112ff5c1d
commit a3692ec213
2 changed files with 323 additions and 118 deletions

View File

@ -2,126 +2,313 @@
Syntax highlighting Syntax highlighting
========================================================================== */ ========================================================================== */
.highlight { div.highlighter-rouge,
figure.highlight {
position: relative;
margin-bottom: 1em;
background: $base00;
color: $base05;
font-family: $monospace-font-family;
line-height: 1.8;
> pre,
pre.highlight {
margin: 0;
padding: 1em; padding: 1em;
background-color: $code-background-color;
pre {
width: 100%;
margin: 0;
} }
}
table { .highlight table {
margin: 0; margin-bottom: 0;
border: 0;
font-size: 1em; font-size: 1em;
tr {
border: 0; border: 0;
}
td { td {
padding: 5px; padding: 0;
width: calc(100% - 1em);
border: 0; border: 0;
/* line numbers gutter */ /* line numbers*/
&.gutter { &.gutter {
padding-right: 1rem; padding-right: 1em;
width: 1em;
color: $base04;
border-right: 1px solid $base04;
text-align: right;
}
/* code */
&.code {
padding-left: 1em;
} }
} }
pre { pre {
margin: 0; margin: 0;
} }
} }
/* line numbers */ .highlight pre {
.lineno { width: 100%;
color: tint($base-color, 50%); }
}
.highlight .hll {
/* background-color: $base06;
Solarized Light }
http://ethanschoonover.com/solarized .highlight {
.c {
SOLARIZED HEX ROLE /* Comment */
--------- -------- ------------------------------------------ color: $base04;
base01 #586e75 body text / default code / primary content }
base1 #93a1a1 comments / secondary content .err {
base3 #fdf6e3 background /* Error */
orange #cb4b16 constants color: $base08;
red #dc322f regex, special keywords }
blue #22b3eb reserved keywords .k {
cyan #2aa198 strings, numbers /* Keyword */
green #859900 operators, other keywords color: $base0e;
========================================================================== */ }
.l {
.c { color: #93a1a1; } /* Comment */ /* Literal */
.err { color: #586e75; } /* Error */ color: $base09;
.g { color: #586e75; } /* Generic */ }
.k { color: #859900; } /* Keyword */ .n {
.l { color: #586e75; } /* Literal */ /* Name */
.n { color: #586e75; } /* Name */ color: $base05;
.o { color: #859900; } /* Operator */ }
.x { color: #cb4b16; } /* Other */ .o {
.p { color: #586e75; } /* Punctuation */ /* Operator */
.cm { color: #93a1a1; } /* Comment.Multiline */ color: $base0c;
.cp { color: #859900; } /* Comment.Preproc */ }
.c1 { color: #93a1a1; } /* Comment.Single */ .p {
.cs { color: #859900; } /* Comment.Special */ /* Punctuation */
.gd { color: #2aa198; } /* Generic.Deleted */ color: $base05;
.ge { color: #586e75; font-style: italic; } /* Generic.Emph */ }
.gr { color: #dc322f; } /* Generic.Error */ .cm {
.gh { color: #cb4b16; } /* Generic.Heading */ /* Comment.Multiline */
.gi { color: #859900; } /* Generic.Inserted */ color: $base04;
.go { color: #586e75; } /* Generic.Output */ }
.gp { color: #586e75; } /* Generic.Prompt */ .cp {
.gs { color: #586e75; font-weight: bold; } /* Generic.Strong */ /* Comment.Preproc */
.gu { color: #cb4b16; } /* Generic.Subheading */ color: $base04;
.gt { color: #586e75; } /* Generic.Traceback */ }
.kc { color: #cb4b16; } /* Keyword.Constant */ .c1 {
.kd { color: #22b3eb; } /* Keyword.Declaration */ /* Comment.Single */
.kn { color: #859900; } /* Keyword.Namespace */ color: $base04;
.kp { color: #859900; } /* Keyword.Pseudo */ }
.kr { color: #22b3eb; } /* Keyword.Reserved */ .cs {
.kt { color: #dc322f; } /* Keyword.Type */ /* Comment.Special */
.ld { color: #586e75; } /* Literal.Date */ color: $base04;
.m { color: #2aa198; } /* Literal.Number */ }
.s { color: #2aa198; } /* Literal.String */ .gd {
.na { color: #586e75; } /* Name.Attribute */ /* Generic.Deleted */
.nb { color: #b58900; } /* Name.Builtin */ color: $base08;
.nc { color: #22b3eb; } /* Name.Class */ }
.no { color: #cb4b16; } /* Name.Constant */ .ge {
.nd { color: #22b3eb; } /* Name.Decorator */ /* Generic.Emph */
.ni { color: #cb4b16; } /* Name.Entity */ font-style: italic;
.ne { color: #cb4b16; } /* Name.Exception */ }
.nf { color: #22b3eb; } /* Name.Function */ .gh {
.nl { color: #586e75; } /* Name.Label */ /* Generic.Heading */
.nn { color: #586e75; } /* Name.Namespace */ color: $base05;
.nx { color: #586e75; } /* Name.Other */ font-weight: bold;
.py { color: #586e75; } /* Name.Property */ }
.nt { color: #22b3eb; } /* Name.Tag */ .gi {
.nv { color: #22b3eb; } /* Name.Variable */ /* Generic.Inserted */
.ow { color: #859900; } /* Operator.Word */ color: $base0b;
.w { color: #586e75; } /* Text.Whitespace */ }
.mf { color: #2aa198; } /* Literal.Number.Float */ .gp {
.mh { color: #2aa198; } /* Literal.Number.Hex */ /* Generic.Prompt */
.mi { color: #2aa198; } /* Literal.Number.Integer */ color: $base04;
.mo { color: #2aa198; } /* Literal.Number.Oct */ font-weight: bold;
.sb { color: #93a1a1; } /* Literal.String.Backtick */ }
.sc { color: #2aa198; } /* Literal.String.Char */ .gs {
.sd { color: #586e75; } /* Literal.String.Doc */ /* Generic.Strong */
.s2 { color: #2aa198; } /* Literal.String.Double */ font-weight: bold;
.se { color: #cb4b16; } /* Literal.String.Escape */ }
.sh { color: #586e75; } /* Literal.String.Heredoc */ .gu {
.si { color: #2aa198; } /* Literal.String.Interpol */ /* Generic.Subheading */
.sx { color: #2aa198; } /* Literal.String.Other */ color: $base0c;
.sr { color: #dc322f; } /* Literal.String.Regex */ font-weight: bold;
.s1 { color: #2aa198; } /* Literal.String.Single */ }
.ss { color: #2aa198; } /* Literal.String.Symbol */ .kc {
.bp { color: #22b3eb; } /* Name.Builtin.Pseudo */ /* Keyword.Constant */
.vc { color: #22b3eb; } /* Name.Variable.Class */ color: $base0e;
.vg { color: #22b3eb; } /* Name.Variable.Global */ }
.vi { color: #22b3eb; } /* Name.Variable.Instance */ .kd {
.il { color: #2aa198; } /* Literal.Number.Integer.Long */ /* Keyword.Declaration */
color: $base0e;
}
.kn {
/* Keyword.Namespace */
color: $base0c;
}
.kp {
/* Keyword.Pseudo */
color: $base0e;
}
.kr {
/* Keyword.Reserved */
color: $base0e;
}
.kt {
/* Keyword.Type */
color: $base0a;
}
.ld {
/* Literal.Date */
color: $base0b;
}
.m {
/* Literal.Number */
color: $base09;
}
.s {
/* Literal.String */
color: $base0b;
}
.na {
/* Name.Attribute */
color: $base0d;
}
.nb {
/* Name.Builtin */
color: $base05;
}
.nc {
/* Name.Class */
color: $base0a;
}
.no {
/* Name.Constant */
color: $base08;
}
.nd {
/* Name.Decorator */
color: $base0c;
}
.ni {
/* Name.Entity */
color: $base05;
}
.ne {
/* Name.Exception */
color: $base08;
}
.nf {
/* Name.Function */
color: $base0d;
}
.nl {
/* Name.Label */
color: $base05;
}
.nn {
/* Name.Namespace */
color: $base0a;
}
.nx {
/* Name.Other */
color: $base0d;
}
.py {
/* Name.Property */
color: $base05;
}
.nt {
/* Name.Tag */
color: $base0c;
}
.nv {
/* Name.Variable */
color: $base08;
}
.ow {
/* Operator.Word */
color: $base0c;
}
.w {
/* Text.Whitespace */
color: $base05;
}
.mf {
/* Literal.Number.Float */
color: $base09;
}
.mh {
/* Literal.Number.Hex */
color: $base09;
}
.mi {
/* Literal.Number.Integer */
color: $base09;
}
.mo {
/* Literal.Number.Oct */
color: $base09;
}
.sb {
/* Literal.String.Backtick */
color: $base0b;
}
.sc {
/* Literal.String.Char */
color: $base05;
}
.sd {
/* Literal.String.Doc */
color: $base04;
}
.s2 {
/* Literal.String.Double */
color: $base0b;
}
.se {
/* Literal.String.Escape */
color: $base09;
}
.sh {
/* Literal.String.Heredoc */
color: $base0b;
}
.si {
/* Literal.String.Interpol */
color: $base09;
}
.sx {
/* Literal.String.Other */
color: $base0b;
}
.sr {
/* Literal.String.Regex */
color: $base0b;
}
.s1 {
/* Literal.String.Single */
color: $base0b;
}
.ss {
/* Literal.String.Symbol */
color: $base0b;
}
.bp {
/* Name.Builtin.Pseudo */
color: $base05;
}
.vc {
/* Name.Variable.Class */
color: $base08;
}
.vg {
/* Name.Variable.Global */
color: $base08;
}
.vi {
/* Name.Variable.Instance */
color: $base08;
}
.il {
/* Literal.Number.Integer.Long */
color: $base09;
}
} }

View File

@ -57,6 +57,24 @@ $code-background-color: tint($base-color, 95%) !default;
$border-color: tint($base-color, 80%) !default; $border-color: tint($base-color, 80%) !default;
$overlay-color: $base-color !default; $overlay-color: $base-color !default;
/* Syntax highlighting (base16) colors */
$base00: #1c2023 !default;
$base01: #393f45 !default;
$base02: #565e65 !default;
$base03: #747c84 !default;
$base04: #adb3ba !default;
$base05: #c7ccd1 !default;
$base06: #dfe2e5 !default;
$base07: #f3f4f5 !default;
$base08: #c7ae95 !default;
$base09: #c7c795 !default;
$base0a: #aec795 !default;
$base0b: #95c7ae !default;
$base0c: #95aec7 !default;
$base0d: #ae95c7 !default;
$base0e: #c795ae !default;
$base0f: #c79595 !default;
/* Max-width of the main content */ /* Max-width of the main content */
$main-max-width: $xlarge !default; $main-max-width: $xlarge !default;