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