diff --git a/src/react/DebugPanel.js b/src/react/DebugPanel.js
index c81a91f9..44f629ac 100644
--- a/src/react/DebugPanel.js
+++ b/src/react/DebugPanel.js
@@ -15,7 +15,6 @@ export function getDefaultStyle(props) {
fontSize: 17,
overflow: 'hidden',
opacity: 0.92,
- background: '#181d20',
color: 'white',
left: left ? 0 : undefined,
right: right ? 0 : undefined,
diff --git a/src/react/JSONTree/JSONArrayNode.js b/src/react/JSONTree/JSONArrayNode.js
index e7075453..bbd21411 100644
--- a/src/react/JSONTree/JSONArrayNode.js
+++ b/src/react/JSONTree/JSONArrayNode.js
@@ -15,17 +15,12 @@ const styles = {
label: {
margin: 0,
padding: 0,
- display: 'inline-block',
- color: '#8fa1b2'
+ display: 'inline-block'
},
span: {
- color: '#C042DF',
fontSize: 12,
cursor: 'default'
},
- spanExpanded: {
- color: '#D7D5D8'
- },
spanType: {
marginLeft: 5,
marginRight: 5,
@@ -64,7 +59,7 @@ export default class JSONArrayNode extends React.Component {
let childNodes = [];
if (this.state.expanded && this.needsChildNodes) {
this.props.data.forEach((element, idx) => {
- childNodes.push(grabNode(idx, element));
+ childNodes.push(grabNode(idx, element, this.props.theme));
});
this.needsChildNodes = false;
this.renderedChildren = childNodes;
@@ -89,18 +84,26 @@ export default class JSONArrayNode extends React.Component {
listStyle: 'none',
display: (this.state.expanded) ? 'block' : 'none'
};
- let containerStyle = {...styles.base, ...styles.parentNode};
- let spanStyle = { ...styles.span };
+ let containerStyle = { ...styles.base, ...styles.parentNode };
+ let spanStyle = {
+ ...styles.span,
+ color: this.props.theme.base0E
+ };
if (this.state.expanded) {
spanStyle = {
...spanStyle,
- ...styles.spanExpanded
+ color: this.props.theme.base05
};
}
return (
-
-
+
+
[]
{this.getItemString()}
diff --git a/src/react/JSONTree/JSONArrow.js b/src/react/JSONTree/JSONArrow.js
index 6a18cc37..1eb964d4 100644
--- a/src/react/JSONTree/JSONArrow.js
+++ b/src/react/JSONTree/JSONArrow.js
@@ -11,7 +11,8 @@ const styles = {
MozTransition: '150ms',
borderLeft: '5px solid transparent',
borderRight: '5px solid transparent',
- borderTop: '5px solid #39ace6',
+ borderTopWidth: 5,
+ borderTopStyle: 'solid',
WebkitTransform: 'rotateZ(-90deg)',
MozTransform: 'rotateZ(-90deg)',
transform: 'rotateZ(-90deg)'
@@ -25,7 +26,10 @@ const styles = {
export default class JSONArrow extends React.Component {
render() {
- let style = { ...styles.base };
+ let style = {
+ ...styles.base,
+ borderTopColor: this.props.theme.base0C
+ };
if (this.props.open) {
style = {
...style,
diff --git a/src/react/JSONTree/JSONBooleanNode.js b/src/react/JSONTree/JSONBooleanNode.js
index 04d42339..e007272f 100644
--- a/src/react/JSONTree/JSONBooleanNode.js
+++ b/src/react/JSONTree/JSONBooleanNode.js
@@ -12,11 +12,7 @@ const styles = {
},
label: {
display: 'inline-block',
- marginRight: 5,
- color: '#8fa1b2'
- },
- value: {
- color: '#08c6eE'
+ marginRight: 5
}
};
@@ -26,8 +22,13 @@ export default class JSONBooleanNode extends React.Component {
const truthString = (this.props.value) ? 'true' : 'false';
return (
-
- {truthString}
+
+ {truthString}
);
}
diff --git a/src/react/JSONTree/JSONNullNode.js b/src/react/JSONTree/JSONNullNode.js
index f1c76971..3898ebd9 100644
--- a/src/react/JSONTree/JSONNullNode.js
+++ b/src/react/JSONTree/JSONNullNode.js
@@ -12,11 +12,7 @@ const styles = {
},
label: {
display: 'inline-block',
- marginRight: 5,
- color: '#8fa1b2'
- },
- value: {
- color: '#DF113A'
+ marginRight: 5
}
};
@@ -25,8 +21,13 @@ export default class JSONNullNode extends React.Component {
render() {
return (
-
- null
+
+ null
);
}
diff --git a/src/react/JSONTree/JSONNumberNode.js b/src/react/JSONTree/JSONNumberNode.js
index e5d33108..3e1fb929 100644
--- a/src/react/JSONTree/JSONNumberNode.js
+++ b/src/react/JSONTree/JSONNumberNode.js
@@ -12,11 +12,7 @@ const styles = {
},
label: {
display: 'inline-block',
- marginRight: 5,
- color: '#8fa1b2'
- },
- value: {
- color: '#0B75F5'
+ marginRight: 5
}
};
@@ -25,8 +21,13 @@ export default class JSONNumberNode extends React.Component {
render() {
return (
-
- {this.props.value}
+
+ {this.props.value}
);
}
diff --git a/src/react/JSONTree/JSONObjectNode.js b/src/react/JSONTree/JSONObjectNode.js
index 9adaf263..9ee33012 100644
--- a/src/react/JSONTree/JSONObjectNode.js
+++ b/src/react/JSONTree/JSONObjectNode.js
@@ -15,17 +15,12 @@ const styles = {
label: {
margin: 0,
padding: 0,
- display: 'inline-block',
- color: '#8fa1b2'
+ display: 'inline-block'
},
span: {
- color: '#049977',
fontSize: 12,
cursor: 'default'
},
- spanExpanded: {
- color: '#D7D5D8'
- },
spanType: {
marginLeft: 5,
marginRight: 5,
@@ -65,7 +60,7 @@ export default class JSONObjectNode extends React.Component {
let childNodes = [];
for (let k in obj) {
if (obj.hasOwnProperty(k)) {
- childNodes.push(grabNode(k, obj[k]));
+ childNodes.push(grabNode(k, obj[k], this.props.theme));
}
}
this.needsChildNodes = false;
@@ -91,18 +86,26 @@ export default class JSONObjectNode extends React.Component {
listStyle: 'none',
display: (this.state.expanded) ? 'block' : 'none'
};
- let containerStyle = {...styles.base, ...styles.parentNode};
- let spanStyle = { ...styles.span };
+ let containerStyle = { ...styles.base, ...styles.parentNode };
+ let spanStyle = {
+ ...styles.span,
+ color: this.props.theme.base0B
+ };
if (this.state.expanded) {
spanStyle = {
...spanStyle,
- ...styles.spanExpanded
+ color: this.props.theme.base05
};
}
return (
-
-
+
+
{}
{this.getItemString()}
diff --git a/src/react/JSONTree/JSONStringNode.js b/src/react/JSONTree/JSONStringNode.js
index 249e0e2a..c775f1d7 100644
--- a/src/react/JSONTree/JSONStringNode.js
+++ b/src/react/JSONTree/JSONStringNode.js
@@ -12,11 +12,7 @@ const styles = {
},
label: {
display: 'inline-block',
- marginRight: 5,
- color: '#8fa1b2'
- },
- value: {
- color: '#717c93'
+ marginRight: 5
}
};
@@ -25,8 +21,13 @@ export default class JSONStringNode extends React.Component {
render() {
return (
-
- {this.props.value}
+
+ {this.props.value}
);
}
diff --git a/src/react/JSONTree/grab-node.js b/src/react/JSONTree/grab-node.js
index ea2d6790..ca4f7006 100644
--- a/src/react/JSONTree/grab-node.js
+++ b/src/react/JSONTree/grab-node.js
@@ -7,21 +7,21 @@ import JSONNumberNode from './JSONNumberNode';
import JSONBooleanNode from './JSONBooleanNode';
import JSONNullNode from './JSONNullNode';
-export default function(key, value) {
+export default function(key, value, theme) {
const nodeType = objType(value);
const aKey = key + Date.now();
if (nodeType === 'Object') {
- return ;
+ return ;
} else if (nodeType === 'Array') {
- return ;
+ return ;
} else if (nodeType === 'String') {
- return ;
+ return ;
} else if (nodeType === 'Number') {
- return ;
+ return ;
} else if (nodeType === 'Boolean') {
- return ;
+ return ;
} else if (nodeType === 'Null') {
- return ;
+ return ;
}
console.error('Unknown node type:', nodeType);
return false;
diff --git a/src/react/JSONTree/index.js b/src/react/JSONTree/index.js
index f40005cd..97d0f774 100644
--- a/src/react/JSONTree/index.js
+++ b/src/react/JSONTree/index.js
@@ -38,9 +38,9 @@ export default class JSONTree extends React.Component {
let rootNode = false;
const keyName = this.props.keyName || 'root';
if (nodeType === 'Object') {
- rootNode = ;
+ rootNode = ;
} else if (nodeType === 'Array') {
- rootNode = ;
+ rootNode = ;
}
return (
diff --git a/src/react/LogMonitor.js b/src/react/LogMonitor.js
index 28954757..4c6d512b 100644
--- a/src/react/LogMonitor.js
+++ b/src/react/LogMonitor.js
@@ -1,26 +1,21 @@
import React, { PropTypes, findDOMNode } from 'react';
import LogMonitorEntry from './LogMonitorEntry';
import LogMonitorButton from './LogMonitorButton';
+import themes from "./themes";
const styles = {
container: {
fontFamily: 'monospace',
position: 'relative',
- overflowY: 'hidden'
+ overflowY: 'hidden',
+ width: '100%',
+ height: '100%'
},
buttonBarWrapper: {
- backgroundColor: '#343c45',
- borderBottom: '1px solid #3f464d',
marginBottom: 1
},
buttonBar: {
paddingLeft: 2
- },
- bordering: {
- 'float': 'left',
- height: 1,
- border: '1px solid #20262c',
- width: '100%'
}
}
@@ -48,6 +43,7 @@ export default class LogMonitor {
static defaultProps = {
select: (state) => state,
monitorState: { isVisible: true },
+ theme: 'ocean'
};
componentWillReceiveProps(nextProps) {
@@ -77,7 +73,6 @@ export default class LogMonitor {
if (this.scrollDown) {
const scrollableNode = node.parentElement;
const { offsetHeight, scrollHeight } = scrollableNode;
-
scrollableNode.scrollTop = scrollHeight - offsetHeight;
this.scrollDown = false;
}
@@ -118,6 +113,17 @@ export default class LogMonitor {
render() {
const elements = [];
const { monitorState, skippedActions, stagedActions, computedStates, select } = this.props;
+ let theme;
+ if (typeof this.props.theme === 'string') {
+ if (typeof themes[this.props.theme] !== 'undefined') {
+ theme = themes[this.props.theme]
+ } else {
+ console.warn('DevTools theme ' + this.props.theme + ' not found, defaulting to ocean');
+ theme = themes.ocean
+ }
+ } else {
+ theme = this.props.theme;
+ }
if (!monitorState.isVisible) {
return null;
}
@@ -129,6 +135,7 @@ export default class LogMonitor {
elements.push(
-
-
- Reset
- {computedStates.length > 1 &&
- Revert
- }
- {Object.keys(skippedActions).some(key => skippedActions[key]) &&
- Sweep
- }
- {computedStates.length > 1 &&
- Commit
- }
-
+
+
+ Reset
+ {computedStates.length > 1 &&
+ Revert
+ }
+ {Object.keys(skippedActions).some(key => skippedActions[key]) &&
+ Sweep
+ }
+ {computedStates.length > 1 &&
+ Commit
+ }
sum + char.charCodeAt(0),
- 0
- ) * Math.abs(Math.sin(token.length));
-
- const h = Math.round((number * (180 / Math.PI) * token.length) % 360);
- const s = number % 100 / 100;
- const v = 1;
-
- return hsvToRgb(h, s, v);
+ const number = (parseInt(finalToken, 36) + finalToken.length) % 8;
+ const themeNumber = 'base0' + (number + 8).toString(16).toUpperCase();
+ return theme[themeNumber];
}
const styles = {
@@ -58,7 +32,7 @@ export default class LogMonitorEntry {
let errorText = error;
if (!errorText) {
try {
- return
+ return
} catch (err) {
errorText = 'Error selecting state.';
}
@@ -82,15 +56,19 @@ export default class LogMonitorEntry {
render() {
const { index, error, action, state, collapsed } = this.props;
- const { r, g, b } = colorFromString(action.type);
const styleEntry = {
opacity: collapsed ? 0.5 : 1,
- color: `rgb(${r}, ${g}, ${b})`,
+ color: colorFromString(this.props.theme, action.type),
cursor: (index > 0) ? 'pointer' : 'default'
};
return (
-
+
{!collapsed &&
- { Object.keys(payload).length > 0 ? : "" }
+ { Object.keys(payload).length > 0 ? : "" }
);
}
render() {
const { type, ...payload } = this.props.action;
return (
-
+
{type}
{!this.props.collapsed ? '' : ''}
diff --git a/src/react/theme.js b/src/react/theme.js
new file mode 100644
index 00000000..de78238c
--- /dev/null
+++ b/src/react/theme.js
@@ -0,0 +1,5 @@
+export default {
+ ocean: {
+
+ }
+};
diff --git a/src/react/themes/index.js b/src/react/themes/index.js
new file mode 100644
index 00000000..c0b1124d
--- /dev/null
+++ b/src/react/themes/index.js
@@ -0,0 +1,5 @@
+import ocean from "./ocean";
+
+export default {
+ ocean,
+};
diff --git a/src/react/themes/ocean.js b/src/react/themes/ocean.js
new file mode 100644
index 00000000..e67bd93f
--- /dev/null
+++ b/src/react/themes/ocean.js
@@ -0,0 +1,20 @@
+export default {
+ scheme: 'Ocean',
+ author: 'Chris Kempson (http://chriskempson.com)',
+ base00: '#2b303b',
+ base01: '#343d46',
+ base02: '#4f5b66',
+ base03: '#65737e',
+ base04: '#a7adba',
+ base05: '#c0c5ce',
+ base06: '#dfe1e8',
+ base07: '#eff1f5',
+ base08: '#bf616a',
+ base09: '#d08770',
+ base0A: '#ebcb8b',
+ base0B: '#a3be8c',
+ base0C: '#96b5b4',
+ base0D: '#8fa1b3',
+ base0E: '#b48ead',
+ base0F: '#ab7967'
+}