Include hack as woff font

This commit is contained in:
kageru 2020-05-03 20:11:01 +02:00
parent b3e77e37e0
commit c40dc7bdfc
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2
2 changed files with 16 additions and 7 deletions

@ -6,8 +6,9 @@ import kotlin.math.ceil
object Css { object Css {
const val FLOATY_CLASS = "floatything" const val FLOATY_CLASS = "floatything"
private val accent1 = Color("#e6db74") private val accent1 = Color("#e6db74") // monokai yellow
private val accent2 = Color("#a6e22e") private val accent2 = Color("#a6e22e") // monokai green
private val selection = Color("#66d9ef") // monokai blue
private val fontcolor = Color.lightGrey private val fontcolor = Color.lightGrey
private val bgcolor = Color("#23241f") private val bgcolor = Color("#23241f")
@ -18,7 +19,7 @@ object Css {
// Text areas apparently grow beyond their parent element if padding and/or borders are added. // Text areas apparently grow beyond their parent element if padding and/or borders are added.
// They always grow to the right, so we simply add more padding to shift everything back (see usage of this). // They always grow to the right, so we simply add more padding to shift everything back (see usage of this).
private const val bodyShift = bodyPadding + 2 * borderpixels + 2 * inputPadding private const val bodyShift = bodyPadding + 2 * borderpixels + 2 * inputPadding
const val fonts = """Hack, "Jetbrains Mono", "Fira Code", "Noto Mono", monospace""" private const val fonts = """Hack, "Jetbrains Mono", "Fira Code", "Noto Mono", monospace"""
private fun StyledElement.defaultBorder() = border(borderpixels.px, BorderStyle.solid, accent1) private fun StyledElement.defaultBorder() = border(borderpixels.px, BorderStyle.solid, accent1)
@ -116,7 +117,8 @@ object Css {
outline = Outline.none outline = Outline.none
} }
rule("::selection") { rule("::selection") {
color = accent1 backgroundColor = selection
color = bgcolor
} }
a { a {
color = accent1 color = accent1

@ -9,17 +9,24 @@ object PastePage {
defaultHead("View paste $uri${type?.let { " (type $it)" } ?: ""}") defaultHead("View paste $uri${type?.let { " (type $it)" } ?: ""}")
link( link(
rel = "stylesheet", rel = "stylesheet",
href = "https://p.kageru.moe/static/hljs.css", href = "/static/hljs.css",
type = "text/css" type = "text/css"
) )
script(src = "https://p.kageru.moe/static/hl.js") {} script(src = "/static/hl.js") {}
// Show the first 3 lines in preview/embed for applications like discord, slack, or skype // Show the first 3 lines in preview/embed for applications like discord, slack, or skype
meta(content = content.lines().take(3).joinToString("\n")) { meta(content = content.lines().take(3).joinToString("\n")) {
attributes["property"] = "og:description" attributes["property"] = "og:description"
} }
unsafe { unsafe {
+"<script>hljs.initHighlightingOnLoad();</script>" +"<script>hljs.initHighlightingOnLoad();</script>"
+"<style>html{scrollbar-color: transparent transparent;}::-webkit-scrollbar{display: none;}</style>" // TODO: find out how CSSBuilder.fontFace is supposed to work and use that instead
+"""<style>html { scrollbar-color: transparent transparent; }::-webkit-scrollbar { display: none; }
@font-face {
font-family: 'Hack';
src: url('fonts/hack.woff2') format('woff2'), url('fonts/hack.woff') format('woff');
font-weight: 400;
font-style: normal;
}</style>""".trimIndent()
} }
} }
body { body {