Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
feat(theme): update style
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Jun 4, 2022
1 parent 1a25241 commit 48fc224
Show file tree
Hide file tree
Showing 14 changed files with 464 additions and 528 deletions.
2 changes: 1 addition & 1 deletion packages/md-enhance/src/client/components/ChartJS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
display: flex;
align-items: center;
justify-content: center;
background: var(--grey15);
background: var(--grey14, #eee);
.loading-icon {
width: 4em;
Expand Down
2 changes: 1 addition & 1 deletion packages/md-enhance/src/client/components/CodeDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
display: flex;
align-items: center;
justify-content: center;
background: var(--grey15);
background: var(--grey14, #eee);
}
.loading-icon {
Expand Down
2 changes: 1 addition & 1 deletion packages/md-enhance/src/client/components/ECharts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
display: flex;
align-items: center;
justify-content: center;
background: var(--grey15);
background: var(--grey14, #eee);
.loading-icon {
width: 4em;
Expand Down
2 changes: 1 addition & 1 deletion packages/md-enhance/src/client/components/FlowChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
display: flex;
justify-content: center;
align-items: center;
background: var(--grey15, #eee);
background: var(--grey14, #eee);
}
@media (max-width: $MQMobileNarrow) {
Expand Down
2 changes: 1 addition & 1 deletion packages/md-enhance/src/client/components/Presentation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
display: flex;
justify-content: center;
align-items: center;
background: var(--grey15, #eee);
background: var(--grey14, #eee);
}
@media (max-width: $MQMobileNarrow) {
Expand Down
2 changes: 1 addition & 1 deletion packages/md-enhance/src/client/styles/mermaid.styl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
display: flex;
justify-content: center;
align-items: center;
background: var(--grey15, #eee);
background: var(--grey14, #eee);

svg {
width: 4em;
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/styles/normalize.styl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ code {
margin: 0;
padding: 0.25rem 0.5rem;
border-radius: 3px;
background: rgb(127 127 127 / 12%);
background: rgba(127 127 127 / 12%);
font-size: 0.85em;
overflow-wrap: break-word;
}
Expand Down
235 changes: 121 additions & 114 deletions packages/theme/styles/code/dark.styl
Original file line number Diff line number Diff line change
@@ -1,153 +1,160 @@
body.theme-dark {
{$contentClass} {
code {
background: var(--grey12);
}
}
/**
* One Light theme for prism.js
* Based on Atom's One Light theme: https://github.com/atom/atom/tree/master/packages/one-light-syntax
* Copied from https://github.com/PrismJS/prism-themes/blob/master/themes/prism-one-dark.css
*/
@require './helper';

.theme-dark {
color-helper($codeColor: #abb2bf, $codeBgColor: #282c34);
}

/**
* prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML
* Based on https://github.com/chriskempson/tomorrow-theme
* @author Rose Pritchard
*/
code[class*='language-'], pre[class*='language-'] {
color: #ccc;
background: none;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 1em;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
code[class*='language-'], pre[class*='language-'] {
text-shadow: 0 1px rgb(0 0 0 / 30%);
// tab size
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;

/* Code blocks */
pre[class*='language-'] {
overflow: auto;
/* Print */
@media print {
text-shadow: none;
}

:not(pre) > code[class*='language-'], pre[class*='language-'] {
background: #2d2d2d;
// Selection
&::selection, ::selection {
background: #3e4451;
color: inherit;
text-shadow: none;
}
}

/* Inline code */
:not(pre) > code[class*='language-'] {
padding: 0.1em;
border-radius: 0.3em;
white-space: normal;
}
.token.comment, .token.prolog, .token.cdata {
color: #5c6370;
}

.token.comment, .token.block-comment, .token.prolog, .token.doctype, .token.cdata {
color: #999;
}
.token.doctype, .token.punctuation, .token.entity {
color: #abb2bf;
}

.token.punctuation {
color: #ccc;
}
.token.attr-name, .token.class-name, .token.boolean, .token.constant, .token.number, .token.atrule {
color: #d19a66;
}

.token.tag, .token.attr-name, .token.namespace, .token.deleted {
color: #e2777a;
}
.token.keyword {
color: #c678dd;
}

.token.function-name {
color: #6196cc;
}
.token.property, .token.tag, .token.symbol, .token.deleted, .token.important {
color: #e06c75;
}

.token.selector, .token.string, .token.char, .token.builtin, .token.inserted, .token.regex, .token.attr-value, .token.attr-value > .token.punctuation {
color: #98c379;
}

.token.variable, .token.operator, .token.function {
color: #61afef;
}

.token.url {
color: #56b6c2;
}

/* HTML overrides */
.token.attr-value > .token.punctuation.attr-equals, .token.special-attr > .token.attr-value > .token.value.css {
color: #abb2bf;
}

.token.boolean, .token.number, .token.function {
color: #f08d49;
/* CSS overrides */
.language-css .token.selector {
color: #e06c75;
}

.language-css .token.property {
color: #abb2bf;
}

.language-css .token.function, .language-css .token.url > .token.function {
color: #56b6c2;
}

.language-css .token.url > .token.string.url {
color: #98c379;
}

.language-css .token.important, .language-css .token.atrule .token.rule {
color: #c678dd;
}

/* JS overrides */
.language-javascript .token.operator {
color: #c678dd;
}

// stylelint-disable selector-max-compound-selectors
.language-javascript {
.token.template-string, > .token.interpolation, > .token.interpolation-punctuation.punctuation {
color: #be5046;
}

.token.property, .token.class-name, .token.constant, .token.symbol {
color: #f8c555;
/* JSON overrides */
.language-json .token.operator {
color: #abb2bf;
}

.token.selector, .token.important, .token.atrule, .token.keyword, .token.builtin {
color: #cc99cd;
.language-json .token.null.keyword {
color: #d19a66;
}

.token.string, .token.char, .token.attr-value, .token.regex, .token.variable {
color: #7ec699;
/* MD overrides */
.language-markdown .token.url, .language-markdown .token.url > .token.operator, .language-markdown .token.url-reference.url > .token.string {
color: #abb2bf;
}

.token.operator, .token.entity, .token.url {
color: #67cdcc;
.language-markdown .token.url > .token.content {
color: #61afef;
}

.token.important, .token.bold {
font-weight: bold;
.language-markdown .token.url > .token.url, .language-markdown .token.url-reference.url {
color: #56b6c2;
}

.token.italic {
.language-markdown .token.blockquote.punctuation, .language-markdown .token.hr.punctuation {
color: #5c6370;
font-style: italic;
}

.token.entity {
cursor: help;
.language-markdown .token.code-snippet {
color: #98c379;
}

.token.inserted {
color: green;
.language-markdown .token.bold .token.content {
color: #d19a66;
}

// hightlight
div[class*='language-'] {
.highlight-lines {
.highlighted {
background: darken(saturate($darkCodeBgColor, 10%), 25%);
}
}

pre, pre[class*='language-'] {
background: transparent;
}

&::before {
color: rgba(255, 255, 255, 0.4);
}

&.line-numbers-mode {
.highlight-lines .highlighted:before {
background: darken(saturate($darkCodeBgColor, 10%), 25%);
}

.line-numbers-wrapper {
color: rgba(255, 255, 255, 0.3);
}

&::after {
border-right: 1px solid darken(saturate($darkCodeBgColor, 10%), 35%);
}
}
.language-markdown .token.italic .token.content {
color: #c678dd;
}

.code-group-nav {
background-color: darken(saturate($darkCodeBgColor, 10%), 35%);
.language-markdown .token.strike .token.content, .language-markdown .token.strike .token.punctuation, .language-markdown .token.list.punctuation, .language-markdown .token.title.important > .token.punctuation {
color: #e06c75;
}

.code-group-nav-tab {
&:hover {
background-color: darken(saturate($darkCodeBgColor, 10%), 5%);
}
/* General */
.token.bold {
font-weight: bold;
}

&.active {
border-bottom: 0;
background-color: $darkCodeBgColor;
.token.comment, .token.italic {
font-style: italic;
}

&:before {
background: radial-gradient(12px at left top, transparent 50%, $darkCodeBgColor 50%);
}
.token.entity {
cursor: help;
}

&:after {
background: radial-gradient(12px at right top, transparent 50%, $darkCodeBgColor 50%);
}
}
.token.namespace {
opacity: 0.8;
}
}
7 changes: 7 additions & 0 deletions packages/theme/styles/code/helper.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
color-helper($codeColor, $codeBgColor) {
--code-color: $codeColor;
--code-line-color: alpha($codeColor, 0.67);
--code-bg-color: $codeBgColor;
--code-border-color: darken(saturate($codeBgColor, 20%), 10%);
--code-highlight-line-color: darken(saturate($codeBgColor, 10%), 5%);
}
Loading

0 comments on commit 48fc224

Please sign in to comment.