mirror of
https://github.com/zaaarf/friendenstein.git
synced 2024-11-12 18:49:22 +01:00
feat: better light mode highlighting
This commit is contained in:
parent
8956abcb84
commit
9ccf994f55
3 changed files with 9 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
public/
|
||||
static/hl-*.css
|
||||
|
|
|
@ -8,12 +8,6 @@ pre {
|
|||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
:root.light {
|
||||
pre {
|
||||
@extend .inverted;
|
||||
}
|
||||
}
|
||||
|
||||
p code,
|
||||
li code,
|
||||
div code {
|
||||
|
|
|
@ -112,15 +112,22 @@
|
|||
--metaColor: {% if config.extra.colors.light.meta_color %}{{ config.extra.colors.light.meta_color }}{% else %}#D26878{% endif %};
|
||||
--linkColor: {% if config.extra.colors.light.link_color %}{{ config.extra.colors.light.link_color }}{% else %}#5690AF{% endif %};
|
||||
--dateLinkColor: {% if config.extra.colors.light.date_link_color %}{{ config.extra.colors.light.date_link_color }}{% else %}#223844{% endif %};
|
||||
--codeLineColor: {% if config.extra.colors.light.code_line_color %}{{ config.extra.colors.light.code_line_color }}{% else %}#CCCCCC{% endif %};
|
||||
--codeLineColor: {% if config.extra.colors.light.code_line_color %}{{ config.extra.colors.light.code_line_color }}{% else %}#FFFFFF{% endif %};
|
||||
}
|
||||
</style>
|
||||
<link id="syntaxHighlighting" rel="stylesheet" type="text/css" href="{{ get_url(path='ayu-dark.css', trailing_slash=false) | safe }}" />
|
||||
<link rel="stylesheet" href="{{ get_url(path='style.css', trailing_slash=false) | safe }}"/>
|
||||
{% endblock css %}
|
||||
<script>
|
||||
const setTheme = (theme) => {
|
||||
document.documentElement.className = theme;
|
||||
localStorage.setItem('theme', theme);
|
||||
var link = document.getElementById('syntaxHighlighting');
|
||||
if (theme === 'light') {
|
||||
link.setAttribute('href', '{{ get_url(path="hl-light.css", trailing_slash=false) | safe }}');
|
||||
} else if (theme === 'dark') {
|
||||
link.setAttribute('href', '{{ get_url(path="hl-dark.css", trailing_slash=false) | safe }}');
|
||||
}
|
||||
}
|
||||
|
||||
const hasCodeRun = localStorage.getItem('hasCodeRun');
|
||||
|
|
Loading…
Reference in a new issue