Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

feat(code): add a way to configure Prism theme #38

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,9 @@ location: Hangzhou
summary: Here's a quick post on what I found.
---
```

## Stylus

You can override the following [Stylus](http://stylus-lang.com/) variables in your `.vuepress/styles/palette.styl`:

<<< @/styles/palette.styl
2 changes: 0 additions & 2 deletions global-components/BaseListLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,3 @@ export default {
width 14px
height 14px
</style>

<style src="prismjs/themes/prism-okaidia.css"></style>
2 changes: 0 additions & 2 deletions layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
<Content v-else />
</div>
</template>

<style src="prismjs/themes/prism-okaidia.css"></style>
2 changes: 0 additions & 2 deletions layouts/Post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ export default {
@media (min-width: $MQNarrow)
box-shadow 0 10px 20px rgba(0, 0, 0, 0.05), 0 6px 6px rgba(0, 0, 0, 0.07)
</style>

<style src="prismjs/themes/prism-okaidia.css"></style>
2 changes: 2 additions & 0 deletions styles/code.styl
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,5 @@ div[class~="language-bash"]:before

div[class~="language-php"]:before
content "php"

@import '~prismjs/themes/prism-' + $prismTheme + '.css'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prism's default theme @import '~prismjs/themes/prism.css won't be able to configure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice catch

1 change: 1 addition & 0 deletions styles/palette.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ $codeBgColor = #000
$arrowBgColor = #ccc

$navbarHeight = 5rem
$prismTheme = 'okaidia' // available themes: https://github.com/PrismJS/prism/tree/master/themes