Skip to content

Commit 301ec82

Browse files
committed
Code highlightjs toggle theme
1 parent a8178a1 commit 301ec82

File tree

2 files changed

+114
-2
lines changed

2 files changed

+114
-2
lines changed

resources/js/components/utils/CodeHighlight/CodeHighlight.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import 'highlight.js/styles/github.min.css'
1212
1313
// Dark set from current dir css
1414
import './css/dark/hybrid-dark.css'
15-
// import './css/dark/atom-one-dark.css'
1615
// import './css/dark/an-old-hope-dark.css'
16+
// import './css/dark/atom-one-dark.css'
17+
// import './css/dark/atom-one-resonable-dark.css'
1718
// import './css/dark/srcery-dark.css'
1819
// import './css/dark/kimbie-dark.css'
1920
@@ -44,7 +45,7 @@ function toggleTheme() {
4445

4546
<template>
4647
<div class="hljs-code-topbar">
47-
<span class="hljs-code-filename">{{ props.filename }}</span>
48+
<span class="hljs-code-filename"><i class="fa-regular fa-file-code"></i> {{ props.filename }}</span>
4849
<button v-if="theme == ''" class="hljs-code-toggle-theme" @click="toggleTheme"><i class="fa-solid fa-toggle-off"></i></button>
4950
<button v-else class="hljs-code-toggle-theme" @click="toggleTheme"><i class="fa-solid fa-toggle-on"></i></button>
5051
</div>
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
pre code.hljs {
2+
display: block;
3+
overflow-x: auto;
4+
padding: 1em;
5+
}
6+
code.hljs {
7+
padding: 3px 5px;
8+
}
9+
/*
10+
11+
Atom One Dark With support for ReasonML by Gidi Morris, based off work by Daniel Gamage
12+
13+
Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax
14+
15+
*/
16+
.dark-theme .hljs {
17+
color: #abb2bf;
18+
background: #282c34;
19+
}
20+
.dark-theme .hljs-keyword,
21+
.dark-theme .hljs-operator {
22+
color: #f92672;
23+
}
24+
.dark-theme .hljs-pattern-match {
25+
color: #f92672;
26+
}
27+
.dark-theme .hljs-pattern-match .hljs-constructor {
28+
color: #61aeee;
29+
}
30+
.dark-theme .hljs-function {
31+
color: #61aeee;
32+
}
33+
.dark-theme .hljs-function .hljs-params {
34+
color: #a6e22e;
35+
}
36+
.dark-theme .hljs-function .hljs-params .hljs-typing {
37+
color: #fd971f;
38+
}
39+
.dark-theme .hljs-module-access .hljs-module {
40+
color: #7e57c2;
41+
}
42+
.dark-theme .hljs-constructor {
43+
color: #e2b93d;
44+
}
45+
.dark-theme .hljs-constructor .hljs-string {
46+
color: #9ccc65;
47+
}
48+
.dark-theme .hljs-comment,
49+
.dark-theme .hljs-quote {
50+
color: #b18eb1;
51+
font-style: italic;
52+
}
53+
.dark-theme .hljs-doctag,
54+
.dark-theme .hljs-string,
55+
.dark-theme .hljs-regexp,
56+
.dark-theme .hljs-symbol,
57+
.dark-theme .hljs-bullet,
58+
.dark-theme .hljs-doctag,
59+
.dark-theme .hljs-formula {
60+
color: #c678dd;
61+
background-image: none;
62+
}
63+
.dark-theme .hljs-section,
64+
.dark-theme .hljs-name,
65+
.dark-theme .hljs-selector-tag,
66+
.dark-theme .hljs-deletion,
67+
.dark-theme .hljs-subst {
68+
color: #e06c75;
69+
}
70+
.dark-theme .hljs-literal {
71+
color: #56b6c2;
72+
}
73+
.dark-theme .hljs-string,
74+
.dark-theme .hljs-regexp,
75+
.dark-theme .hljs-addition,
76+
.dark-theme .hljs-attribute,
77+
.dark-theme .hljs-meta .hljs-string {
78+
color: #98c379;
79+
}
80+
.dark-theme .hljs-built_in,
81+
.dark-theme .hljs-title.class_,
82+
.dark-theme .hljs-class .hljs-title {
83+
color: #e6c07b;
84+
}
85+
.dark-theme .hljs-attr,
86+
.dark-theme .hljs-variable,
87+
.dark-theme .hljs-template-variable,
88+
.dark-theme .hljs-type,
89+
.dark-theme .hljs-selector-class,
90+
.dark-theme .hljs-selector-attr,
91+
.dark-theme .hljs-selector-pseudo,
92+
.dark-theme .hljs-number {
93+
color: #d19a66;
94+
}
95+
.dark-theme .hljs-symbol,
96+
.dark-theme .hljs-bullet,
97+
.dark-theme .hljs-link,
98+
.dark-theme .hljs-meta,
99+
.dark-theme .hljs-selector-id,
100+
.dark-theme .hljs-title {
101+
color: #61aeee;
102+
}
103+
.dark-theme .hljs-emphasis {
104+
font-style: italic;
105+
}
106+
.dark-theme .hljs-strong {
107+
font-weight: bold;
108+
}
109+
.dark-theme .hljs-link {
110+
text-decoration: underline;
111+
}

0 commit comments

Comments
 (0)