Merge pull request #661 from edoardoo/darkTheme

Implemented dark theme.
This commit is contained in:
Christoph (Sheogorath) Kern 2018-01-16 14:38:14 +07:00 committed by GitHub
commit 7201144661
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 199 additions and 12 deletions

View file

@ -102,5 +102,6 @@
"Select From Available Snippets": "Select From Available Snippets", "Select From Available Snippets": "Select From Available Snippets",
"OR": "OR", "OR": "OR",
"Export to Snippet": "Export to Snippet", "Export to Snippet": "Export to Snippet",
"Select Visibility Level": "Select Visibility Level" "Select Visibility Level": "Select Visibility Level",
"Night Theme": "Night Theme"
} }

View file

@ -179,6 +179,11 @@
border-left: 1px solid black; border-left: 1px solid black;
} }
.night .ui-toc-dropdown .nav>li>a:focus, .night .ui-toc-dropdown .nav>li>a:hover{
color: white;
border-left-color: white;
}
.ui-toc-dropdown[dir='rtl'] .nav>li>a:focus,.ui-toc-dropdown[dir='rtl'] .nav>li>a:hover { .ui-toc-dropdown[dir='rtl'] .nav>li>a:focus,.ui-toc-dropdown[dir='rtl'] .nav>li>a:hover {
padding-right: 19px; padding-right: 19px;
border-left: none; border-left: none;
@ -192,6 +197,10 @@
background-color: transparent; background-color: transparent;
border-left: 2px solid black; border-left: 2px solid black;
} }
.night .ui-toc-dropdown .nav>.active:focus>a,.night .ui-toc-dropdown .nav>.active:hover>a,.night .ui-toc-dropdown .nav>.active>a {
color: white;
border-left: 2px solid white;
}
.ui-toc-dropdown[dir='rtl'] .nav>.active:focus>a,.ui-toc-dropdown[dir='rtl'] .nav>.active:hover>a,.ui-toc-dropdown[dir='rtl'] .nav>.active>a { .ui-toc-dropdown[dir='rtl'] .nav>.active:focus>a,.ui-toc-dropdown[dir='rtl'] .nav>.active:hover>a,.ui-toc-dropdown[dir='rtl'] .nav>.active>a {
padding-right: 18px; padding-right: 18px;
@ -216,6 +225,10 @@
font-weight: 400; font-weight: 400;
} }
.night .ui-toc-dropdown .nav > li > a{
color: #aaa;
}
.ui-toc-dropdown[dir='rtl'] .nav .nav>li>a { .ui-toc-dropdown[dir='rtl'] .nav .nav>li>a {
padding-right: 30px; padding-right: 30px;
} }
@ -350,13 +363,23 @@ small .dropdown a:focus, small .dropdown a:hover {
} }
.unselectable { .unselectable {
-moz-user-select: none; -moz-user-select: none;
-khtml-user-select: none; -khtml-user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
-o-user-select: none; -o-user-select: none;
user-select: none; user-select: none;
} }
.night .navbar{
background: #333;
border-bottom-color: #333;
color: #eee;
}
.night .navbar a{
color: #eee;
}
@media print { @media print {
div, table, img, pre, blockquote { div, table, img, pre, blockquote {
page-break-inside: avoid !important; page-break-inside: avoid !important;
@ -364,4 +387,4 @@ small .dropdown a:focus, small .dropdown a:hover {
a[href]:after { a[href]:after {
font-size: 12px !important; font-size: 12px !important;
} }
} }

View file

@ -68,6 +68,9 @@
color: #777; color: #777;
border-left: 0.25em solid #ddd; border-left: 0.25em solid #ddd;
} }
.night .markdown-body blockquote{
color: #bcbcbc;
}
.markdown-body blockquote>:first-child { .markdown-body blockquote>:first-child {
margin-top: 0; margin-top: 0;
@ -107,6 +110,15 @@
line-height: 1.25; line-height: 1.25;
} }
.night .markdown-body h1,
.night .markdown-body h2,
.night .markdown-body h3,
.night .markdown-body h4,
.night .markdown-body h5,
.night .markdown-body h6 {
color: #ddd;
}
.markdown-body h1 .octicon-link, .markdown-body h1 .octicon-link,
.markdown-body h2 .octicon-link, .markdown-body h2 .octicon-link,
.markdown-body h3 .octicon-link, .markdown-body h3 .octicon-link,
@ -118,6 +130,15 @@
visibility: hidden; visibility: hidden;
} }
.night .markdown-body h1 .octicon-link,
.night .markdown-body h2 .octicon-link,
.night .markdown-body h3 .octicon-link,
.night .markdown-body h4 .octicon-link,
.night .markdown-body h5 .octicon-link,
.night .markdown-body h6 .octicon-link {
color: #fff;
}
.markdown-body h1:hover .anchor, .markdown-body h1:hover .anchor,
.markdown-body h2:hover .anchor, .markdown-body h2:hover .anchor,
.markdown-body h3:hover .anchor, .markdown-body h3:hover .anchor,
@ -180,6 +201,8 @@
color: #777 color: #777
} }
.markdown-body ul, .markdown-body ul,
.markdown-body ol { .markdown-body ol {
padding-left: 2em padding-left: 2em
@ -246,11 +269,19 @@
background-color: #fff; background-color: #fff;
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
} }
.night .markdown-body table tr {
background-color: #5f5f5f;
}
.markdown-body table tr:nth-child(2n) { .markdown-body table tr:nth-child(2n) {
background-color: #f8f8f8; background-color: #f8f8f8;
} }
.night .markdown-body table tr:nth-child(2n){
background-color: #4f4f4f;
}
.markdown-body img { .markdown-body img {
max-width: 100%; max-width: 100%;
box-sizing: content-box; box-sizing: content-box;
@ -370,6 +401,14 @@
border-radius: 3px; border-radius: 3px;
} }
.night .markdown-body code,
.night .markdown-body tt {
color: #eee;
background-color: rgba(230, 230, 230, 0.36);
}
.markdown-body code::before, .markdown-body code::before,
.markdown-body code::after, .markdown-body code::after,
.markdown-body tt::before, .markdown-body tt::before,
@ -512,4 +551,4 @@
margin: 0.31em 0 0.2em -1.3em !important; margin: 0.31em 0 0.2em -1.3em !important;
vertical-align: middle; vertical-align: middle;
cursor: default !important; cursor: default !important;
} }

View file

@ -10,6 +10,16 @@ body {
padding-top: 51px; padding-top: 51px;
/*overflow: hidden;*/ /*overflow: hidden;*/
} }
.night a,
.night .open-files-container li.selected a {
color: #5EB7E0;
}
body.night{
background: #333 !important;
}
.CodeMirror { .CodeMirror {
font-family: "Source Code Pro", Consolas, monaco, monospace; font-family: "Source Code Pro", Consolas, monaco, monospace;
letter-spacing: 0.025em; letter-spacing: 0.025em;
@ -117,6 +127,11 @@ body {
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
} }
.night .ui-content{
background-color: #333;
}
.ui-edit-area { .ui-edit-area {
height: 100%; height: 100%;
/*padding-left: 15px;*/ /*padding-left: 15px;*/
@ -144,6 +159,12 @@ body {
.ui-edit-area .ui-sync-toggle:active { .ui-edit-area .ui-sync-toggle:active {
box-shadow: inset 0 3px 5px rgba(0,0,0,.125), 2px 0px 2px #e7e7e7; box-shadow: inset 0 3px 5px rgba(0,0,0,.125), 2px 0px 2px #e7e7e7;
} }
.night .ui-edit-area .ui-resizable-handle.ui-resizable-e{
background: #3c3c3c;
box-shadow: 3px 0px 6px #353535;
}
.ui-view-area { .ui-view-area {
/*overflow-y: scroll;*/ /*overflow-y: scroll;*/
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
@ -154,6 +175,13 @@ body {
padding-right: 15px; padding-right: 15px;
} }
} }
.night .ui-view-area{
background: #333;
color: #ededed;
}
.ui-scrollable { .ui-scrollable {
height: 100%; height: 100%;
overflow-x: hidden; overflow-x: hidden;
@ -238,12 +266,32 @@ body {
.navbar-nav > li > a { .navbar-nav > li > a {
cursor: pointer; cursor: pointer;
} }
.night .navbar-default .navbar-nav > li > a:focus,
.night .navbar-default .navbar-nav > li > a:hover,
.night .navbar-default .navbar-brand:focus,
.night .navbar-default .navbar-brand:hover{
color: #fff;
}
.night .navbar-default .navbar-nav > .open > a,
.night .navbar-default .navbar-nav > .open > a:focus,
.night .navbar-default .navbar-nav > .open > a:hover {
color: white;
background: #000;
}
.dropdown-menu > li > a { .dropdown-menu > li > a {
cursor: pointer; cursor: pointer;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: calc(100vw - 30px); max-width: calc(100vw - 30px);
overflow: hidden; overflow: hidden;
} }
.night .dropdown-menu{
background: #222;
}
.dropdown-menu.CodeMirror-other-cursor { .dropdown-menu.CodeMirror-other-cursor {
transition: none; transition: none;
} }
@ -276,8 +324,8 @@ div[contenteditable]:empty:not(:focus):before{
max-height: 40vh; max-height: 40vh;
overflow: auto; overflow: auto;
} }
.dropdown-menu.list::-webkit-scrollbar { .dropdown-menu.list::-webkit-scrollbar {
display: none; display: none;
} }
.dropdown-menu .emoji { .dropdown-menu .emoji {
margin-bottom: 0 !important; margin-bottom: 0 !important;
@ -292,6 +340,16 @@ div[contenteditable]:empty:not(:focus):before{
background: inherit; background: inherit;
} }
.night .navbar .btn-default{
background-color: #333;
border-color: #565656;
color: #eee;
}
.night .btn.btn-default.ui-view.active{
background: #202020;
}
.btn-file { .btn-file {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
@ -312,6 +370,12 @@ div[contenteditable]:empty:not(:focus):before{
display: block; display: block;
} }
.night .btn.focus,
.night .btn:focus,
.night .btn:hover{
color: #fff;
}
.info-label { .info-label {
width: 36%; width: 36%;
text-align: right; text-align: right;
@ -481,8 +545,8 @@ div[contenteditable]:empty:not(:focus):before{
border: 1px solid #2893ef; border: 1px solid #2893ef;
} }
.status-bar .indent-width-input::-webkit-inner-spin-button, .status-bar .indent-width-input::-webkit-inner-spin-button,
.status-bar .indent-width-input::-webkit-outer-spin-button { .status-bar .indent-width-input::-webkit-outer-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
} }
@ -524,4 +588,4 @@ div[contenteditable]:empty:not(:focus):before{
.CodeMirror { .CodeMirror {
height: auto !important; height: auto !important;
} }
} }

View file

@ -69,6 +69,12 @@
border-collapse: inherit !important; border-collapse: inherit !important;
} }
.night .markdown-body .gist table tr:nth-child(2n){
background-color: #ddd;
}
.markdown-body code[data-gist-id] { .markdown-body code[data-gist-id] {
background: none; background: none;
padding: 0; padding: 0;
@ -93,6 +99,7 @@
.markdown-body code[data-gist-id] table tr { .markdown-body code[data-gist-id] table tr {
background: unset; background: unset;
} }
/*fixed style for rtl in pre and code*/ /*fixed style for rtl in pre and code*/
@ -121,6 +128,16 @@
white-space: inherit; white-space: inherit;
} }
.night .markdown-body pre.graphviz .graph > polygon{
fill: #333;
}
.night .markdown-body pre.mermaid .titleText,
.night .markdown-body pre.mermaid text,
.night .markdown-body pre.mermaid .sectionTitle{
fill: white;
}
.markdown-body pre.flow-chart > code, .markdown-body pre.flow-chart > code,
.markdown-body pre.sequence-diagram > code, .markdown-body pre.sequence-diagram > code,
.markdown-body pre.graphviz > code, .markdown-body pre.graphviz > code,
@ -138,6 +155,27 @@
height: 100%; height: 100%;
} }
.night .markdown-body .abc path{
fill: #eee;
}
.night .markdown-body .abc path.note_selected{
fill: ##4DD0E1;
}
.night tspan{
fill: #fefefe;
}
.night pre rect{
fill: transparent;
}
.night pre.flow-chart rect,
.night pre.flow-chart path{
stroke: white;
}
.markdown-body pre > code.wrap { .markdown-body pre > code.wrap {
white-space: pre-wrap; /* Since CSS 2.1 */ white-space: pre-wrap; /* Since CSS 2.1 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */

View file

@ -1633,6 +1633,10 @@ ui.toolbar.view.click(function () {
ui.toolbar.both.click(function () { ui.toolbar.both.click(function () {
changeMode(modeType.both) changeMode(modeType.both)
}) })
ui.toolbar.night.click(function () {
toggleNightMode()
})
// permission // permission
// freely // freely
ui.infobar.permission.freely.click(function () { ui.infobar.permission.freely.click(function () {
@ -1666,6 +1670,17 @@ $('.ui-delete-modal-confirm').click(function () {
socket.emit('delete') socket.emit('delete')
}) })
function toggleNightMode () {
var $body = $('body')
var isActive = ui.toolbar.night.hasClass('active')
if (isActive) {
$body.removeClass('night')
appState.nightMode = false
} else {
$body.addClass('night')
appState.nightMode = true
}
}
function emitPermission (_permission) { function emitPermission (_permission) {
if (_permission !== permission) { if (_permission !== permission) {
socket.emit('permission', _permission) socket.emit('permission', _permission)

View file

@ -2,7 +2,8 @@ import modeType from './modeType'
let state = { let state = {
syncscroll: true, syncscroll: true,
currentMode: modeType.view currentMode: modeType.view,
nightMode: false
} }
export default state export default state

View file

@ -37,6 +37,7 @@ export const getUIElements = () => ({
edit: $('.ui-edit'), edit: $('.ui-edit'),
view: $('.ui-view'), view: $('.ui-view'),
both: $('.ui-both'), both: $('.ui-both'),
night: $('.ui-night'),
uploadImage: $('.ui-upload-image') uploadImage: $('.ui-upload-image')
}, },
infobar: { infobar: {

View file

@ -96,6 +96,11 @@
<input type="radio" name="mode" autocomplete="off"><i class="fa fa-pencil"></i> <input type="radio" name="mode" autocomplete="off"><i class="fa fa-pencil"></i>
</label> </label>
</div> </div>
<div class="btn-group" data-toggle="buttons">
<label class="btn ui-night" title="<%= __('Night Theme') %>">
<input type="checkbox" name="night"><i class="fa fa-moon-o"></i>
</label>
</div>
<span class="btn btn-link btn-file ui-help" title="<%= __('Help') %>" data-toggle="modal" data-target=".help-modal"> <span class="btn btn-link btn-file ui-help" title="<%= __('Help') %>" data-toggle="modal" data-target=".help-modal">
<i class="fa fa-question-circle"></i> <i class="fa fa-question-circle"></i>
</span> </span>