1// "_hl-adoc-template.scss"             v1.0.0 | 2019/03/25 | by Tristano Ajmone
2// *****************************************************************************
3// *                                                                           *
4// *                 Highlight Theme Template for Asciidoctor                  *
5// *                                                                           *
6// *****************************************************************************
7// A reusable variables-based '@import' template to quickly define Highlight
8// themes for Asciidoctor. It can create both generic themes as well as themes
9// targeting a specific language, via the $HL-Lang variable.
10
11// =============================================================================
12// Default Values
13// =============================================================================
14// Let's define some defaults for the template variables, so users don't have to
15// define every single variable.
16
17$HL-Border-radius:  4px !default;
18$HL-Border-width:   1px !default;
19$HL-Font-family: Consolas, Monaco, "Courier New", Courier, monospace  !default;
20$HL-Font-size:      1em !default;
21
22// -----------------------------------------------------------------------------
23// Default Scheme: Base16 Eighties, by Chris Kempson (http://chriskempson.com)
24// -----------------------------------------------------------------------------
25$HL-LangNameHover:  #a09f93 !default; // base04 : Lang name color (when hovering)
26
27$HL-Canvas:         #2d2d2d !default; // base00
28$HL-Default:        #d3d0c8 !default; // base05
29$HL-LineNum:        #747369 !default; // base03
30
31$HL-Border-color:   #a09f93 !default; // base04
32$HL-Border-radius:  4px     !default;
33$HL-Border-width:   1px     !default;
34
35$HL-Number:         #f99157 !default; // base09
36$HL-Escape:         #f99157 !default; // base09
37$HL-Interpolation:  #d27b53 !default; // base0F
38$HL-String:         #99cc99 !default; // base0B
39$HL-PreProcessor:   #cc99cc !default; // base0E
40$HL-StringPreProc:  #66cccc !default; // base0C
41$HL-BlockComment:   #a09f93 !default; // base04
42$HL-LineComment:    $HL-BlockComment !default;
43$HL-Operator:       $HL-Default !default;
44$HL-Keywords1:      #f2777a !default; // base08
45$HL-Keywords2:      #ffcc66 !default; // base0A
46$HL-Keywords3:      #6699cc !default; // base0D
47$HL-Keywords4:      #cc99cc !default; // base0E
48$HL-Keywords5:      #66cccc !default; // base0C
49$HL-Keywords6:      #d27b53 !default; // base0F
50
51// -----------------------------------------------------------------------------
52// Optional Language Settings
53// -----------------------------------------------------------------------------
54// If $HL-Lang is set, the output theme will target that language, otherwise it
55// will be a generic theme for Highlight.
56
57$HL-Lang:        null         !default;
58$ref_datalang:   "data-lang"  !default;
59$ref_lang:       "lang"       !default;
60
61@if $HL-Lang == null {
62  $ref_datalang: "data-lang"  !global;
63  $ref_lang:     "lang"       !global;
64} @else {
65  $ref_datalang: "data-lang=#{$HL-Lang}" !global;
66  $ref_lang:     "lang=#{$HL-Lang}"      !global;
67}
68
69// =============================================================================
70// Theme Definition
71// =============================================================================
72
73.listingblock code[#{$ref_datalang}]::before{
74   // Color of language name (shown when hovering)
75    color: $HL-LangNameHover;
76}
77.listingblock pre[class="highlight"][#{$ref_lang}] {
78    background-color: $HL-Canvas;
79    &>code {
80        color: $HL-Default;
81        font-family: $HL-Font-family;
82        font-size: $HL-Font-size;
83    }
84    border-radius: $HL-Border-radius;
85    border: $HL-Border-width solid $HL-Border-color;
86    .hl {
87        color: $HL-Default;
88
89        &.num {
90            // Numbers
91            color: $HL-Number;
92        }
93        &.esc {
94            // Escape sequences
95            color: $HL-Escape;
96        }
97        &.ipl {
98            // Interpolation sequences
99            color: $HL-Interpolation;
100        }
101        &.str {
102            // Strings
103            color: $HL-String;
104        }
105        &.ppc {
106            // Preprocessor directives
107            color: $HL-PreProcessor;
108        }
109        &.pps {
110            // Strings within preprocessor directives
111            color: $HL-StringPreProc;
112        }
113        &.com {
114            // Block comments
115            color: $HL-BlockComment;
116            font-style: italic;
117        }
118        &.slc {
119            // Single-line comments
120            color: $HL-LineComment;
121            font-style: italic;
122        }
123        &.lin {
124            // Line numbers
125            color: $HL-LineNum;
126        }
127        &.opt {
128            // Operators
129            color: $HL-Operator;
130        }
131        // ---------------------
132        //    Keywords Groups
133        // ---------------------
134        &.kwa, &.kwb, &.kwc, &.kwd, &.kwe, &.kwf {
135            // font-weight: bold;
136        }
137        &.kwa {
138            // Keywords group 1
139            color: $HL-Keywords1;
140        }
141        &.kwb {
142            // Keywords group 2
143            color: $HL-Keywords2;
144        }
145        &.kwc {
146            // Keywords group 3
147            color: $HL-Keywords3;
148        }
149        &.kwd {
150            // Keywords group 4
151            color: $HL-Keywords4;
152        }
153        &.kwde{
154            // Keywords group 5
155            color: $HL-Keywords5;
156        }
157        &.kwf {
158            // Keywords group 6
159            color: $HL-Keywords6;
160        }
161    }
162}
163// EOF //
164