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