From ee319718ac292b76247b9a065a381e048bbdd4f1 Mon Sep 17 00:00:00 2001 From: Jarek Samic Date: Mon, 28 Dec 2020 02:09:05 -0500 Subject: [PATCH] Add ayu-highlight.css --- .gitignore | 1 + static/ayu-highlight.css | 79 ++++++++++++++++++++++++++++++++++++++++ templates/macros.html | 4 +- 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 static/ayu-highlight.css diff --git a/.gitignore b/.gitignore index e07d538be..e4d65bc4e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ target *.css *.css.map !vendor/**/*.css +!static/ayu-highlight.css .sass-cache .vagrant .rustwide diff --git a/static/ayu-highlight.css b/static/ayu-highlight.css new file mode 100644 index 000000000..38eb90626 --- /dev/null +++ b/static/ayu-highlight.css @@ -0,0 +1,79 @@ +/* +Based off of the Ayu theme +Original by Dempfi (https://github.com/dempfi/ayu) +*/ + +.hljs { + display: block; + overflow-x: auto; + background: #191f26; + color: #e6e1cf; + padding: 0.5em; +} + +.hljs-comment, +.hljs-quote { + color: #5c6773; + font-style: italic; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-attr, +.hljs-regexp, +.hljs-link, +.hljs-selector-id, +.hljs-selector-class { + color: #ff7733; +} + +.hljs-number, +.hljs-meta, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #ffee99; +} + +.hljs-string, +.hljs-bullet { + color: #b8cc52; +} + +.hljs-title, +.hljs-built_in, +.hljs-section { + color: #ffb454; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-symbol { + color: #ff7733; +} + +.hljs-name { + color: #36a3d9; +} + +.hljs-tag { + color: #00568d; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-addition { + color: #91b362; +} + +.hljs-deletion { + color: #d96c75; +} diff --git a/templates/macros.html b/templates/macros.html index cac4f54d4..e13d801bb 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -26,8 +26,10 @@ // Choose which highlight.js theme to load based on the user theme var stylesheet; switch(document.documentElement.dataset.theme) { - case "dark": case "ayu": + stylesheet = "/-/static/ayu-highlight.css"; + break; + case "dark": stylesheet = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/dark.min.css"; break; case "null": // The user is visiting docs.rs for the first time and hasn't set a theme yet.