diff --git a/src/css/prism.css b/src/css/prism.css index d88afd3..204381f 100644 --- a/src/css/prism.css +++ b/src/css/prism.css @@ -1,284 +1,202 @@ -pre[class*='language-'] { - --padding-y: var(--am-prism-padding-y, 1rem); - --padding-x: var(--am-prism-padding-x, 1rem); - padding: var(--padding-y) var(--padding-x); - overflow: auto; - font-size: var(--am-prism-font-size, 0.85em); - border-radius: var(--am-prism-border-radius, 0.4em); -} -pre > code[class*='language-'] { - --am-prism-font-family: 'M PLUS 1 Code'; - padding: initial; - font-size: 1em; - font-weight: 400; - font-optical-sizing: auto; - font-style: normal; - font-family: var(--am-prism-font-family, ui-monospace), monospace; - line-height: var(--am-prism-line-height, 1.5); - background-color: initial; -} -code[class*='language-'], -pre[class*='language-'] { - 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; -} -pre[class*='language-'] .line-numbers-rows { - box-sizing: content-box; - margin: calc(var(--padding-y) * -1) 0; - padding: var(--padding-y) 0; - max-height: 100%; - overflow: hidden; -} -.line-numbers.line-numbers .line-numbers-rows { - border-right-width: var(--am-prism-border-width, 1px); - border-right-color: var(--am-prism-border-color); -} -.line-numbers .line-numbers-rows > span:before { - color: var(--am-prism-line-numbers-color); -} -div.code-toolbar > .toolbar { - top: 0.3rem !important; - right: 0.3rem !important; -} -div.code-toolbar > .toolbar > .toolbar-item > button.copy-to-clipboard-button { - display: inline-flex; - padding: 0 0.75em; - font-size: var(--am-prism-font-size, 0.8em); - font-family: var(--am-prism-font-family, ui-monospace), monospace; - font-weight: 600 !important; - line-height: 2.25em; - color: var(--am-prism-copy-color); - background-color: var(--am-prism-copy-bg); - border-radius: calc(var(--am-prism-border-radius, 0.4em) - 0.1em); - cursor: pointer; - box-shadow: none; - opacity: 1; - transition: opacity 0.2s; -} -div.code-toolbar > .toolbar > .toolbar-item > button.copy-to-clipboard-button:hover { - opacity: 0.8; -} -div.code-toolbar > .toolbar > .toolbar-item > button.copy-to-clipboard-button:focus { - opacity: 1; -} -code[class*='language-'], -pre[class*='language-'] { - color: #24292f; -} -code[class*='language-']::selection, -pre[class*='language-']::selection { - text-shadow: none; - background: #9fc6e9; -} -pre[class*='language-'] { - background: #f6f8fa; -} -:not(pre) > code[class*='language-'] { - padding: 0.1em 0.3em; - border-radius: 0.3em; - color: #24292f; - background: #eff1f3; -} -pre[data-line] { - position: relative; -} -pre[class*='language-'] > code[class*='language-'] { - position: relative; - z-index: 1; -} -.line-highlight { - position: absolute; - left: 0; - right: 0; - padding: inherit 0; - margin-top: 1em; - background: #fff8c5; - box-shadow: inset 5px 0 0 #eed888; - z-index: 0; - pointer-events: none; - line-height: inherit; - white-space: pre; -} -.namespace { - opacity: 0.7; -} -.token.cdata, -.token.comment, -.token.doctype, -.token.prolog { - color: #6e7781; -} -.token.punctuation { - color: #24292f; -} -.token.boolean, -.token.constant, -.token.deleted, -.token.number, -.token.property, -.token.symbol, -.token.tag { - color: #0550ae; -} -.token.attr-name, -.token.builtin, -.token.char, -.token.inserted, -.token.selector, -.token.string { - color: #0a3069; -} -.language-css .token.string, -.style .token.string, -.token.entity, -.token.operator, -.token.url { - color: #0550ae; -} -.token.atrule, -.token.attr-value, -.token.keyword { - color: #cf222e; -} -.token.function { - color: #8250df; -} -.token.important, -.token.regex, -.token.variable { - color: #0a3069; -} -.token.bold, -.token.important { - font-weight: 700; -} -.token.italic { - font-style: italic; -} -.token.entity { - cursor: help; -} :root { - --am-prism-line-numbers-color: #6e778177; - --am-prism-border-color: #6e778122; - --am-prism-copy-color: #24292faa; - --am-prism-copy-bg: #6e778122; + --text-color: #4c4f69; + --background-color: #e6e9ef; + + --token-color-keyword: #8839ef; + --token-color-builtin: #d20f39; + --token-color-class-name: #df8e1d; + --token-color-function: #1e66f5; + --token-color-number: #fe640b; + --token-color-string: #40a02b; + --token-color-symbol: var(--token-color-class-name); + --token-color-regex: #ea76cb; + --token-color-url: var(--token-color-string); + --token-color-operator: #04a5e5; + --token-color-variable: #4c4f69; + --token-color-constant: var(--token-color-number); + --token-color-property: var(--token-color-function); + --token-color-punctuation: #7c7f93; + --token-color-important: var(--token-color-keyword); + --token-color-comment: var(--token-color-punctuation); + --token-color-tag: var(--token-color-function); + --token-color-attr-name: var(--token-color-class-name); + --token-color-attr-value: var(--token-color-string); + --token-color-namespace: var(--token-color-class-name); + --token-color-doctype: var(--token-color-keyword); + --token-color-cdata: #179299; + --token-color-entity: var(--token-color-builtin); + --token-color-atrule: var(--token-color-keyword); + --token-color-selector: var(--token-color-function); + --token-color-deleted: var(--token-color-builtin); + --token-color-inserted: var(--token-color-string); } @media (prefers-color-scheme: dark) { - code[class*='language-'], - pre[class*='language-'] { - color: #c9d1d9; - } - code[class*='language-']::selection, - pre[class*='language-']::selection { - text-shadow: none; - background: #234879; - } - pre[class*='language-'] { - background: #161b22; - } - :not(pre) > code[class*='language-'] { - padding: 0.1em 0.3em; - border-radius: 0.3em; - color: #c9d1d9; - background: #343942; - } - pre[data-line] { - position: relative; - } - pre[class*='language-'] > code[class*='language-'] { - position: relative; - z-index: 1; - } - .line-highlight { - position: absolute; - left: 0; - right: 0; - padding: inherit 0; - margin-top: 1em; - background: #2f2a1e; - box-shadow: inset 5px 0 0 #674c16; - z-index: 0; - pointer-events: none; - line-height: inherit; - white-space: pre; - } - .namespace { - opacity: 0.7; - } - .token.cdata, - .token.comment, - .token.doctype, - .token.prolog { - color: #8b949e; - } - .token.punctuation, - .token.variable { - color: #c9d1d9; - } - .token.boolean, - .token.constant, - .token.deleted, - .token.number, - .token.property, - .token.symbol, - .token.tag { - color: #79c0ff; - } - .token.attr-name, - .token.builtin, - .token.char, - .token.inserted, - .token.selector, - .token.string { - color: #a5d6ff; - } - .language-css .token.string, - .style .token.string, - .token.entity, - .token.operator, - .token.url { - color: #a5d6ff; - background: #161b22; - } - .token.atrule, - .token.keyword { - color: #a5d6ff; - } - .token.attr-value, - .token.function { - color: #d2a8ff; - } - .token.class-name, - .token.important, - .token.regex { - color: #a8daff; - } - .token.bold, - .token.important { - font-weight: 700; - } - .token.italic { - font-style: italic; - } - .token.entity { - cursor: help; - } :root { - --am-prism-line-numbers-color: #8b949e55; - --am-prism-border-color: #8b949e22; - --am-prism-copy-color: #c9d1d9; - --am-prism-copy-bg: #8b949e22; + --text-color: #c6d0f5; + --background-color: #292c3c; + + --token-color-keyword: #ca9ee6; + --token-color-builtin: #e78284; + --token-color-class-name: #e5c890; + --token-color-function: #8caaee; + --token-color-number: #ef9f76; + --token-color-string: #a6d189; + --token-color-symbol: var(--token-color-class-name); + --token-color-regex: #f4b8e4; + --token-color-url: var(--token-color-string); + --token-color-operator: #99d1db; + --token-color-variable: #c6d0f5; + --token-color-constant: var(--token-color-number); + --token-color-property: var(--token-color-function); + --token-color-punctuation: #949cbb; + --token-color-important: var(--token-color-keyword); + --token-color-comment: var(--token-color-punctuation); + --token-color-tag: var(--token-color-function); + --token-color-attr-name: var(--token-color-class-name); + --token-color-attr-value: var(--token-color-string); + --token-color-namespace: var(--token-color-class-name); + --token-color-doctype: var(--token-color-keyword); + --token-color-cdata: #81c8be; + --token-color-entity: var(--token-color-builtin); + --token-color-atrule: var(--token-color-keyword); + --token-color-selector: var(--token-color-function); + --token-color-deleted: var(--token-color-builtin); + --token-color-inserted: var(--token-color-string); + } +} + +:where(pre, code)[class*='language-'] { + color: var(--text-color); +} + +:where(:not(pre) > code, pre)[class*='language-'] { + background: var(--background-color); +} + +/* https://prismjs.com/tokens.html */ + +.token { + &.keyword { + color: var(--token-color-keyword); + } + + &.builtin { + color: var(--token-color-builtin); + } + + &.class-name { + color: var(--token-color-class-name); + } + + &.function { + color: var(--token-color-function); + } + + &.boolean, + &.number { + color: var(--token-color-number); + } + + &.string, + &.char { + color: var(--token-color-string); + } + + &.symbol { + color: var(--token-color-symbol); + } + + &.regex { + color: var(--token-color-regex); + } + + &.url { + color: var(--token-color-url); + } + + &.operator { + color: var(--token-color-operator); + } + + &.variable { + color: var(--token-color-variable); + } + + &.constant { + color: var(--token-color-constant); + } + + &.property { + color: var(--token-color-property); + } + + &.punctuation { + color: var(--token-color-punctuation); + } + + &.important { + color: var(--token-color-important); + } + + &.comment { + color: var(--token-color-comment); + } + + &.tag { + color: var(--token-color-tag); + } + + &.attr-name { + color: var(--token-color-attr-name); + } + + &.attr-value { + color: var(--token-color-attr-value); + } + + &.namespace { + color: var(--token-color-namespace); + } + + &.prolog, + &.doctype { + color: var(--token-color-doctype); + } + + &.cdata { + color: var(--token-color-cdata); + } + + &.entity { + color: var(--token-color-entity); + } + + &.atrule { + color: var(--token-color-atrule); + } + + &.selector { + color: var(--token-color-selector); + } + + /* Diff */ + + &.deleted { + color: var(--token-color-deleted); + } + + &.inserted { + color: var(--token-color-inserted); + } + + /* Other */ + + &.important, + &.bold { + font-weight: bold; + } + &.italic { + font-style: italic; } }