Skip to content

Instantly share code, notes, and snippets.

@ksbrooksjr
Last active March 15, 2019 21:56
Show Gist options
  • Save ksbrooksjr/0ad492d540d4fb9c968cb8cd52c520b3 to your computer and use it in GitHub Desktop.
Save ksbrooksjr/0ad492d540d4fb9c968cb8cd52c520b3 to your computer and use it in GitHub Desktop.
const solarizedLight = `
.hljs, pre, code {
background: #fdf6e3;
color: #657b83;
font-family: 'Roboto Mono', monospace;
font-weight: 600;
}
.hljs-comment,.hljs-quote {
color: #93a1a1;
}
.hljs-keyword,.hljs-selector-tag,.hljs-addition {
color: #859900;
}
.hljs-number,.hljs-string,.hljs-meta .hljs-meta-string,.hljs-literal,.hljs-doctag,.hljs-regexp {
color: #2aa198;
}
.hljs-title,.hljs-section,.hljs-name,.hljs-selector-id,.hljs-selector-class {
color: #268bd2;
}
.hljs-attribute,.hljs-attr,.hljs-variable,.hljs-template-variable,.hljs-class .hljs-title,.hljs-type {
color: #b58900;
}
.hljs-symbol,.hljs-bullet,.hljs-subst,.hljs-meta,.hljs-meta .hljs-keyword,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-link {
color: #cb4b16;
}
.hljs-built_in,.hljs-deletion {
color: #dc322f;
}
.hljs-formula {
background: #eee8d5;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
p > code {
border: none !important;
}
`
;(() => {
const $ = document.querySelectorAll.bind(document)
const changeColors = (color, background) => e => {
e.style.backgroundColor = background
e.style.color = color
}
const fontWeight = e => (e.style.fontWeight = '700')
const elements = [
$('body'),
$('ol li a'),
$('h1'),
$('h2'),
$('h3'),
$('h4'),
$('h5'),
$('h6'),
$('i.material-icons'),
$('p code'),
$('#__next div'),
]
const black = 'black'
const white = 'white'
const blue = '#2289d1'
const grey = '#f2f2f2'
const originalTheme =
'https://storage.googleapis.com/async-await/vs2015.min.css'
elements.forEach(e => e.forEach(changeColors(black, white)))
$('p a').forEach(changeColors(blue, white))
$('p a').forEach(fontWeight)
$('#__next div a').forEach(fontWeight)
$('link').forEach(link => {
if (link.getAttribute('href') === originalTheme) link.remove()
})
const style = document.createElement('style')
const link = document.createElement('link')
link.setAttribute(
'href',
'https://fonts.googleapis.com/css?family=Roboto+Mono:400,400i'
)
link.setAttribute('rel', 'stylesheet')
style.appendChild(document.createTextNode(solarizedLight))
document.head.appendChild(style)
document.head.appendChild(link)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment