Merge pull request #317 from crodriguez1a/feature/dark-theme

Dark theme for better contrast on darker backgrounds
This commit is contained in:
Knut Sveidqvist 2016-03-14 07:14:37 +01:00
commit e9c6db4d8c
8 changed files with 785 additions and 2 deletions

275
dist/mermaid.dark.css vendored Normal file
View File

@ -0,0 +1,275 @@
/* Flowchart variables */
/* Sequence Diagram variables */
/* Gantt chart variables */
.mermaid .label {
color: #323D47;
}
.node rect,
.node circle,
.node ellipse,
.node polygon {
fill: #BDD5EA;
stroke: #81B1DB;
stroke-width: 1px;
}
.edgePath .path {
stroke: lightgrey;
}
.edgeLabel {
background-color: #e8e8e8;
}
.cluster rect {
fill: #6D6D65 !important;
rx: 4 !important;
stroke: rgba(255, 255, 255, 0.25) !important;
stroke-width: 1px !important;
}
.cluster text {
fill: #F9FFFE;
}
.actor {
stroke: #81B1DB;
fill: #BDD5EA;
}
text.actor {
fill: black;
stroke: none;
}
.actor-line {
stroke: lightgrey;
}
.messageLine0 {
stroke-width: 1.5;
stroke-dasharray: "2 2";
marker-end: "url(#arrowhead)";
stroke: lightgrey;
}
.messageLine1 {
stroke-width: 1.5;
stroke-dasharray: "2 2";
stroke: lightgrey;
}
#arrowhead {
fill: lightgrey !important;
}
#crosshead path {
fill: lightgrey !important;
stroke: lightgrey !important;
}
.messageText {
fill: lightgrey;
stroke: none;
}
.labelBox {
stroke: #81B1DB;
fill: #BDD5EA;
}
.labelText {
fill: #323D47;
stroke: none;
}
.loopText {
fill: lightgrey;
stroke: none;
}
.loopLine {
stroke-width: 2;
stroke-dasharray: "2 2";
marker-end: "url(#arrowhead)";
stroke: #81B1DB;
}
.note {
stroke: rgba(255, 255, 255, 0.25);
fill: #fff5ad;
}
.noteText {
fill: black;
stroke: none;
font-family: 'trebuchet ms', verdana, arial;
font-size: 14px;
}
/** Section styling */
.section {
stroke: none;
opacity: 0.2;
}
.section0 {
fill: rgba(255, 255, 255, 0.3);
}
.section2 {
fill: #EAE8B9;
}
.section1,
.section3 {
fill: white;
opacity: 0.2;
}
.sectionTitle0 {
fill: #F9FFFE;
}
.sectionTitle1 {
fill: #F9FFFE;
}
.sectionTitle2 {
fill: #F9FFFE;
}
.sectionTitle3 {
fill: #F9FFFE;
}
.sectionTitle {
text-anchor: start;
font-size: 11px;
text-height: 14px;
}
/* Grid and axis */
.grid .tick {
stroke: rgba(255, 255, 255, 0.3);
opacity: 0.3;
shape-rendering: crispEdges;
}
.grid .tick text {
fill: lightgrey;
opacity: 0.5;
}
.grid path {
stroke-width: 0;
}
/* Today line */
.today {
fill: none;
stroke: #DB5757;
stroke-width: 2px;
}
/* Task styling */
/* Default task */
.task {
stroke-width: 1;
}
.taskText {
text-anchor: middle;
font-size: 11px;
}
.taskTextOutsideRight {
fill: #323D47;
text-anchor: start;
font-size: 11px;
}
.taskTextOutsideLeft {
fill: #323D47;
text-anchor: end;
font-size: 11px;
}
/* Specific task settings for the sections*/
.taskText0,
.taskText1,
.taskText2,
.taskText3 {
fill: #323D47;
}
.task0,
.task1,
.task2,
.task3 {
fill: #BDD5EA;
stroke: rgba(255, 255, 255, 0.5);
}
.taskTextOutside0,
.taskTextOutside2 {
fill: lightgrey;
}
.taskTextOutside1,
.taskTextOutside3 {
fill: lightgrey;
}
/* Active task */
.active0,
.active1,
.active2,
.active3 {
fill: #81B1DB;
stroke: rgba(255, 255, 255, 0.5);
}
.activeText0,
.activeText1,
.activeText2,
.activeText3 {
fill: #323D47 !important;
}
/* Completed task */
.done0,
.done1,
.done2,
.done3 {
fill: lightgrey;
}
.doneText0,
.doneText1,
.doneText2,
.doneText3 {
fill: #323D47 !important;
}
/* Tasks on the critical line */
.crit0,
.crit1,
.crit2,
.crit3 {
stroke: #E83737;
fill: #E83737;
stroke-width: 2;
}
.activeCrit0,
.activeCrit1,
.activeCrit2,
.activeCrit3 {
stroke: #E83737;
fill: #81B1DB;
stroke-width: 2;
}
.doneCrit0,
.doneCrit1,
.doneCrit2,
.doneCrit3 {
stroke: #E83737;
fill: lightgrey;
stroke-width: 1;
cursor: pointer;
shape-rendering: crispEdges;
}
.doneCritText0,
.doneCritText1,
.doneCritText2,
.doneCritText3 {
fill: lightgrey !important;
}
.activeCritText0,
.activeCritText1,
.activeCritText2,
.activeCritText3 {
fill: #323D47 !important;
}
.titleText {
text-anchor: middle;
font-size: 18px;
fill: lightgrey;
}
/*
*/
.node text {
font-family: 'trebuchet ms', verdana, arial;
font-size: 14px;
}
div.mermaidTooltip {
position: absolute;
text-align: center;
max-width: 200px;
padding: 2px;
font-family: 'trebuchet ms', verdana, arial;
font-size: 12px;
background: #6D6D65;
border: 1px solid rgba(255, 255, 255, 0.25);
border-radius: 2px;
pointer-events: none;
z-index: 100;
}

29
src/less/dark/flow.less Normal file
View File

@ -0,0 +1,29 @@
.mermaid .label { color: @darkTextColor }
.node rect,
.node circle,
.node ellipse,
.node polygon {
fill: @mainBkg;
stroke: @nodeBorder;
stroke-width: 1px;
}
.edgePath .path {
stroke: @lineColor;
}
.edgeLabel {
background-color: @edgeLabelBackground;
}
.cluster rect{
fill: @secondBkg !important;
rx: 4 !important;
stroke: @clusterBorder !important;
stroke-width: 1px !important;
}
.cluster text {
fill: @titleColor;
}

140
src/less/dark/gantt.less Normal file
View File

@ -0,0 +1,140 @@
/** Section styling */
.section {
stroke: none;
opacity: 0.2;
}
.section0{
fill: @sectionBkgColor;
}
.section2 {
fill: @sectionBkgColor2;
}
.section1,.section3 {
fill: @altSectionBkgColor;
opacity: 0.2;
}
.sectionTitle0 { fill: @titleColor;}
.sectionTitle1 { fill: @titleColor;}
.sectionTitle2 { fill: @titleColor;}
.sectionTitle3 { fill: @titleColor;}
.sectionTitle {
text-anchor: start;
font-size: 11px;
text-height: 14px;
}
/* Grid and axis */
.grid .tick {
stroke: @sectionBkgColor;
opacity: 0.3;
shape-rendering: crispEdges;
}
.grid .tick text {
fill: @taskTextLightColor;
opacity: 0.5;
}
.grid path {
stroke-width: 0;
}
/* Today line */
.today {
fill: none;
stroke: @todayLineColor;
stroke-width: 2px;
}
/* Task styling */
/* Default task */
.task {
stroke-width: 1;
}
.taskText {
text-anchor: middle;
font-size: 11px;
}
.taskTextOutsideRight {
fill: @taskTextDarkColor;
text-anchor: start;
font-size: 11px;
}
.taskTextOutsideLeft {
fill: @taskTextDarkColor;
text-anchor: end;
font-size: 11px;
}
/* Specific task settings for the sections*/
.taskText0, .taskText1, .taskText2, .taskText3 {
fill: @taskTextColor;
}
.task0, .task1, .task2, .task3 {
fill: @taskBkgColor;
stroke: @taskBorderColor;
}
.taskTextOutside0,.taskTextOutside2, {
fill: @taskTextOutsideColor;
}
.taskTextOutside1, .taskTextOutside3 {
fill: @taskTextOutsideColor;
}
/* Active task */
.active0, .active1, .active2, .active3 {
fill: @activeTaskBkgColor;
stroke: @activeTaskBorderColor;
}
.activeText0, .activeText1, .activeText2, .activeText3 {
fill: @taskTextDarkColor !important;
}
/* Completed task */
.done0, .done1, .done2, .done3 {
fill: @doneTaskBkgColor;
}
.doneText0, .doneText1, .doneText2, .doneText3 {
fill: @taskTextDarkColor !important;
}
/* Tasks on the critical line */
.crit0, .crit1, .crit2, .crit3 {
stroke: @critBorderColor;
fill: @critBkgColor;
stroke-width: 2;
}
.activeCrit0, .activeCrit1, .activeCrit2, .activeCrit3 {
stroke: @critBorderColor;
fill: @activeTaskBkgColor;
stroke-width: 2;
}
.doneCrit0, .doneCrit1, .doneCrit2, .doneCrit3 {
stroke: @critBorderColor;
fill: @doneTaskBkgColor;
stroke-width: 1;
cursor: pointer;
shape-rendering: crispEdges;
}
.doneCritText0, .doneCritText1, .doneCritText2, .doneCritText3 {
fill: @taskTextLightColor !important;
}
.activeCritText0, .activeCritText1, .activeCritText2, .activeCritText3 {
fill: @taskTextDarkColor !important;
}
.titleText {
text-anchor: middle;
font-size: 18px;
fill: @taskTextLightColor;
}
/*
*/

View File

@ -0,0 +1,24 @@
@import "variables";
@import "flow";
@import "sequenceDiagram";
@import "gantt";
@import "variables";
.node text {
font-family: 'trebuchet ms', verdana, arial;
font-size:14px;
}
div.mermaidTooltip {
position: absolute;
text-align: center;
max-width: 200px;
padding: 2px;
font-family: 'trebuchet ms', verdana, arial;
font-size: 12px;
background: @secondBkg;
border: 1px solid @border2;
border-radius: 2px;
pointer-events: none;
z-index:100;
}

View File

@ -0,0 +1,76 @@
.actor {
stroke: @actorBorder;
fill: @actorBkg;
}
text.actor {
fill: @actorTextColor;
stroke: none;
}
.actor-line {
stroke: @actorLineColor;
}
.messageLine0 {
stroke-width: 1.5;
stroke-dasharray: "2 2";
marker-end: "url(#arrowhead)";
stroke: @signalColor;
}
.messageLine1 {
stroke-width: 1.5;
stroke-dasharray: "2 2";
stroke: @signalColor;
}
#arrowhead {
fill: @signalColor !important;
}
#crosshead path {
fill: @signalColor !important;
stroke: @signalColor !important;
}
.messageText {
fill: @signalTextColor;
stroke: none;
}
.labelBox {
stroke: @labelBoxBorderColor;
fill: @labelBoxBkgColor;
}
.labelText {
fill: @darkTextColor;
stroke: none;
}
.loopText {
fill: @labelTextColor;
stroke: none;
}
.loopLine {
stroke-width: 2;
stroke-dasharray: "2 2";
marker-end: "url(#arrowhead)";
stroke: @labelBoxBorderColor;
}
.note {
//stroke: #decc93;
stroke: @noteBorderColor;
fill: @noteBkgColor;
}
.noteText {
fill: black;
stroke: none;
font-family: 'trebuchet ms', verdana, arial;
font-size: 14px;
}

View File

@ -0,0 +1,63 @@
@mainBkg: #BDD5EA;
@secondBkg: #6D6D65;
@mainContrastColor: lightgrey;
@darkTextColor: #323D47;
@lineColor: @mainContrastColor;
@border1: #81B1DB;
@border2: rgba(255, 255, 255, 0.25);
/* Flowchart variables */
@nodeBkg:@mainBkg;
@nodeBorder:@border1;
@clusterBkg:@secondBkg;
@clusterBorder:@border2;
@defaultLinkColor:@lineColor;
@titleColor: #F9FFFE;
@edgeLabelBackground: #e8e8e8;
/* Sequence Diagram variables */
@actorBorder: @border1;
@actorBkg: @mainBkg;
@actorTextColor: black;
@actorLineColor: @mainContrastColor;
@signalColor: @mainContrastColor;
@signalTextColor: @mainContrastColor;
@labelBoxBkgColor: @actorBkg;
@labelBoxBorderColor: @actorBorder;
@labelTextColor: @mainContrastColor;
@noteBorderColor: @border2;
@noteBkgColor: #fff5ad;
/* Gantt chart variables */
@sectionBkgColor: rgba(255, 255, 255, 0.3);
@altSectionBkgColor: white;
@sectionBkgColor2: #EAE8B9;
@taskBorderColor: rgba(255, 255, 255, 0.5);
@taskBkgColor: @mainBkg;
@taskTextColor: @darkTextColor;
@taskTextOutsideColor: @taskTextLightColor;
@activeTaskBorderColor: rgba(255, 255, 255, 0.5);
@activeTaskBkgColor: #81B1DB;
@gridColor: @mainContrastColor;
@doneTaskBkgColor: @mainContrastColor;
@doneTaskBorderColor: grey;
@critBorderColor: #E83737;
@critBkgColor: #E83737;
@taskTextLightColor: @mainContrastColor;
@taskTextDarkColor: @darkTextColor;
@todayLineColor: #DB5757;

176
test/mix-dark-theme.html Normal file
View File

@ -0,0 +1,176 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="../dist/mermaid.js"></script>
<link rel="stylesheet" href="../dist/mermaid.dark.css"/>
<script>
var mermaid_config = {
startOnLoad:true,
htmlLabels:true
}
mermaid.sequenceConfig = {
diagramMarginX:50,
diagramMarginY:10,
boxTextMargin:5,
noteMargin:10,
messageMargin:35,
mirrorActors:true,
width:150,
// Height of actor boxes
height:30
};
mermaid.ganttConfig = {
titleTopMargin:25,
barHeight:20,
barGap:4,
topPadding:50,
sidePadding:100,
gridLineStartPadding:35,
fontSize:11,
numberSectionStyles:4,
axisFormatter: [
// Within a day
["%I:%M", function (d) {
return d.getHours();
}],
// Monday a week
["w. %U", function (d) {
return d.getDay() == 1;
}],
// Day within a week (not monday)
["%a %d", function (d) {
return d.getDay() && d.getDate() != 1;
}],
// within a month
["%b %d", function (d) {
return d.getDate() != 1;
}],
// Month
["%m-%y", function (d) {
return d.getMonth();
}]
]
};
mermaid.startOnLoad=true;
</script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- Simulate Darker Themed Page -->
<style>
body {
background: #323D47;
font-family: sans-serif;
}
</style>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
</head>
<body>
<div class="mermaid">graph LR
subgraph old sys 1
a1(new client)-->b1(sys1 server)
oc1(Old client)-->b2
end
subgraph old sys 2
a2(new client)-->b2(sys2 server)
oc2(Old client)-->b2
end
subgraph old sys 3
a3(new client)-->b3(sys3 server)
end
subgraph New sys
a1
a2
a3
end
</div>
<hr/>
<div class="mermaid">
graph LR;
A[Now with default style on links]--v-->B{a = '1,2'}
B-->|v|C[v]
B-- ... default style on links -->Z>My default thing this]
C-->D{condition};
linkStyle 0 stroke-width:2px,fill:none,stroke:steelblue;
linkStyle default stroke-width:2px,fill:none,stroke:crimson;
</div>
<hr/>
<div class="mermaid">
graph LR
A[Square Rect] -- Link text --> B((Circle))
A[Square Rect]--v-->D((Circle))
A --> C(Round Rect)
B == testing ==> D{Rhombus}
C-.->D
</div>
<hr/>
<div class="mermaid">
sequenceDiagram
participant Alice
participant Bob
participant John the Long
Alice->>Bob: Hello Bob, how are you?
loop Outer loop
Note left of Alice: Bob thinks about <br/> things <br/> to think about
Bob-xBob: I am good thanks!
loop Inner loop
Bob->>John the Long: How about you John?
Note right of John the Long: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit.
end
end
Bob-->>Alice: Checking with John...
Alice->>John the Long: Yes... John, how are you?
John the Long-->>Alice: Super!
</div>
<hr/>
<div class="mermaid">
gantt
dateFormat YYYY-MM-DD
title Adding GANTT diagram functionality to mermaid
section A section
Completed task :done, des1, 2014-01-06,2014-01-08
Active task :active, des2, 2014-01-09, 3d
Future task : des3, after des2, 5d
Future task2 : des4, after des3, 5d
section Critical tasks
Completed task in the critical line :crit, done, 2014-01-06,24h
Implement parser and jison :crit, done, after des1, 2d
Create tests for parser :crit, active, 3d
Future task in critical line :crit, 5d
Create tests for renderer :2d
Add to mermaid :1d
section Documentation
Describe gantt syntax :active, a1, after des1, 3d
Add gantt diagram to demo page :after a1 , 20h
Add another diagram to demo page :doc1, after a1 , 48h
section Last section
Describe gantt syntax :after doc1, 3d
Add gantt diagram to demo page : 20h
Add another diagram to demo page : 48h
</div>
<div class="mermaid">
info
</div>
</body>
</html>

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../dist/mermaid.forest.css"/>
<script src="../dist/mermaid.full.js"></script>
<script src="../dist/mermaid.js"></script>
<script>
var mermaid_config = {
startOnLoad:true,
@ -154,7 +154,7 @@
Describe gantt syntax :active, a1, after des1, 3d
Add gantt diagram to demo page :after a1 , 20h
Add another diagram to demo page :doc1, after a1 , 48h
section Last section
Describe gantt syntax :after doc1, 3d
Add gantt diagram to demo page : 20h