diff --git a/src/app/assets/stylesheets/_themes.scss b/src/app/assets/stylesheets/_themes.scss index 7478604ec1dfd54f50b51bcc773560e6c68d59f3..8a071012fa70bddccbf0dd5bccd5277a636d583a 100755 --- a/src/app/assets/stylesheets/_themes.scss +++ b/src/app/assets/stylesheets/_themes.scss @@ -39,6 +39,8 @@ $themes: ( buttonBoxShadow: $color-transparent, modalBackgroundColor: $color-background-almost-white, modalTextColorPrimary: $color-text-dark, + htmlhtmlCodeColor: #333333, + htmlhtmlCodeBackgroundColor: #f4f4f4, ), light: ( colorAccent: $color-hive-red, @@ -81,6 +83,8 @@ $themes: ( buttonBoxShadowHover: $color-hive-black, modalBackgroundColor: $color-white, modalTextColorPrimary: $color-text-dark, + htmlCodeColor: #333333, + htmlCodeBackgroundColor: #f4f4f4, ), dark: ( colorAccent: $color-hive-red, @@ -124,6 +128,8 @@ $themes: ( inputPriceWarning: rgba(255, 153, 0, 0.83), modalBackgroundColor: $color-background-dark, modalTextColorPrimary: $color-text-white, + htmlCodeColor: #c5c8c6, + htmlCodeBackgroundColor: #1d1f21, ), ); diff --git a/src/app/assets/stylesheets/markdown.scss b/src/app/assets/stylesheets/markdown.scss index 606455d17bc910ee23f76fb523601da6986d1fd5..a0f53feb9b80028b0c70c66ba8d5511d147bb0a7 100644 --- a/src/app/assets/stylesheets/markdown.scss +++ b/src/app/assets/stylesheets/markdown.scss @@ -59,12 +59,16 @@ code { padding: 0.2rem; - font-size: 85%; + font-size: 0.90rem; + line-height: 1.2rem; border-radius: 3px; border: none; - background-color: #F4F4F4; font-weight: inherit; overflow: scroll; + @include themify($themes) { + color: themed('htmlCodeColor'); + background-color: themed('htmlCodeBackgroundColor'); + } } pre > code { diff --git a/src/app/components/all.scss b/src/app/components/all.scss index 57d31ae66f0080b3c74795558e59e52abb2c5d2e..03138c1cf5f18485e863385c4269e6b830755ddc 100644 --- a/src/app/components/all.scss +++ b/src/app/components/all.scss @@ -6,6 +6,7 @@ @import "./cards/MarkdownViewer"; @import "./cards/PostSummary"; @import "./cards/PostFull"; +@import "./cards/PostFull-code"; @import "./cards/PostsList"; @import "./cards/NotificationsList"; diff --git a/src/app/components/cards/PostFull-code.scss b/src/app/components/cards/PostFull-code.scss new file mode 100644 index 0000000000000000000000000000000000000000..35df550470f98392ea89008a63b295ff5c788109 --- /dev/null +++ b/src/app/components/cards/PostFull-code.scss @@ -0,0 +1,153 @@ +.theme-light { + /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + + /* Tomorrow Comment */ + .hljs-comment, + .hljs-quote { + color: #8e908c; + } + + /* Tomorrow Red */ + .hljs-variable, + .hljs-template-variable, + .hljs-tag, + .hljs-name, + .hljs-selector-id, + .hljs-selector-class, + .hljs-regexp, + .hljs-deletion { + color: #c82829; + } + + /* Tomorrow Orange */ + .hljs-number, + .hljs-built_in, + .hljs-builtin-name, + .hljs-literal, + .hljs-type, + .hljs-params, + .hljs-meta, + .hljs-link { + color: #f5871f; + } + + /* Tomorrow Yellow */ + .hljs-attribute { + color: #eab700; + } + + /* Tomorrow Green */ + .hljs-string, + .hljs-symbol, + .hljs-bullet, + .hljs-addition { + color: #718c00; + } + + /* Tomorrow Blue */ + .hljs-title, + .hljs-section { + color: #4271ae; + } + + /* Tomorrow Purple */ + .hljs-keyword, + .hljs-selector-tag { + color: #8959a8; + } + + .hljs { + display: block; + overflow-x: auto; + background: white; + color: #4d4d4c; + padding: 0.5em; + } + + .hljs-emphasis { + font-style: italic; + } + + .hljs-strong { + font-weight: bold; + } + +} + +.theme-dark { + /* Tomorrow Night Theme */ + /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + /* Original theme - https://github.com/chriskempson/tomorrow-theme */ + /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + + /* Tomorrow Comment */ + .hljs-comment, + .hljs-quote { + color: #969896; + } + + /* Tomorrow Red */ + .hljs-variable, + .hljs-template-variable, + .hljs-tag, + .hljs-name, + .hljs-selector-id, + .hljs-selector-class, + .hljs-regexp, + .hljs-deletion { + color: #cc6666; + } + + /* Tomorrow Orange */ + .hljs-number, + .hljs-built_in, + .hljs-builtin-name, + .hljs-literal, + .hljs-type, + .hljs-params, + .hljs-meta, + .hljs-link { + color: #de935f; + } + + /* Tomorrow Yellow */ + .hljs-attribute { + color: #f0c674; + } + + /* Tomorrow Green */ + .hljs-string, + .hljs-symbol, + .hljs-bullet, + .hljs-addition { + color: #b5bd68; + } + + /* Tomorrow Blue */ + .hljs-title, + .hljs-section { + color: #81a2be; + } + + /* Tomorrow Purple */ + .hljs-keyword, + .hljs-selector-tag { + color: #b294bb; + } + + .hljs { + display: block; + overflow-x: auto; + background: #1d1f21; + color: #c5c8c6; + padding: 0.5em; + } + + .hljs-emphasis { + font-style: italic; + } + + .hljs-strong { + font-weight: bold; + } +} diff --git a/src/app/components/cards/PostFull.jsx b/src/app/components/cards/PostFull.jsx index 313a384cfeb69476b9ffcec640cd038c162a7776..940b4bcc8b42f48ed06aed601e0713220568e9fa 100644 --- a/src/app/components/cards/PostFull.jsx +++ b/src/app/components/cards/PostFull.jsx @@ -1,7 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router'; -import 'highlight.js/styles/tomorrow.css'; import TimeAgoWrapper from 'app/components/elements/TimeAgoWrapper'; import Icon from 'app/components/elements/Icon'; import { connect } from 'react-redux';