Skip to content

Commit b0d07ba

Browse files
authored
Merge pull request #107 from Coding/yangzhen/add-dark-theme
Add dark theme, close coding/WebIDE#80, close coding/WebIDE#165,
2 parents a7b28de + 74fa66a commit b0d07ba

File tree

27 files changed

+651
-47
lines changed

27 files changed

+651
-47
lines changed

app/components/MenuBar/menuBarItems.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,45 @@ import * as GitActions from '../Git/actions'
44
import React from 'react'
55
import mapShortcutToItems from './utils'
66

7+
var codingLogo = (
8+
<div className='menu-bar-item-logo'>
9+
<svg
10+
version='1.1'
11+
id='Layer_3'
12+
xmlns='http://www.w3.org/2000/svg'
13+
x='0px'
14+
y='0px'
15+
width='407.5px'
16+
height='306.577px'
17+
viewBox='0 0 407.5 306.577'
18+
enableBackground='new 0 0 407.5 306.577'
19+
>
20+
<g>
21+
<ellipse cx='159.785' cy='167.517' rx='3.656' ry='4.39' />
22+
<ellipse cx='246.618' cy='167.517' rx='3.656' ry='4.39' />
23+
<path d='M299.252,139.319c-5.997,0-11.253,3.803-14.191,9.509c-9.997-21.679-30.795-41.764-56.498-50.035
24+
c-13.869-5.534-23.608-16.155-24.812-28.568c-1.204,12.413-10.943,23.034-24.812,28.568c-25.703,8.271-46.501,28.355-56.498,50.035
25+
c-2.938-5.706-8.194-9.509-14.191-9.509c-9.21,0-16.676,8.965-16.676,20.025c0,11.059,7.466,20.025,16.676,20.025
26+
c2.801,0,5.439-0.833,7.757-2.299c0.793,35.91,39.753,59.219,87.745,59.282c47.991-0.062,86.952-23.372,87.745-59.282
27+
c2.318,1.466,4.956,2.299,7.757,2.299c9.21,0,16.676-8.965,16.676-20.025C315.928,148.285,308.461,139.319,299.252,139.319z
28+
M115.83,165.602c-0.78,2.883-4.253,4.111-7.757,2.744c-3.504-1.367-5.712-4.812-4.932-7.695c0.78-2.883,4.253-4.111,7.757-2.744
29+
S116.61,162.72,115.83,165.602z M203.75,226.356c-38.492-0.06-69.664-18.201-69.664-44.17c0-0.544,0.02-1.083,0.046-1.621
30+
c0.009-0.177,0.018-0.354,0.03-0.531c0.024-0.367,0.057-0.732,0.093-1.097c0.049-0.489,0.107-0.976,0.178-1.46
31+
c0.007-0.048,0.013-0.096,0.02-0.144c0.775-5.104,2.759-12.893,5.755-17.382c7.198-10.412,20.037-17.348,34.684-17.348
32+
c11.276,0,21.473,4.118,28.858,10.759c7.385-6.641,17.582-10.759,28.858-10.759c14.647,0,27.486,6.937,34.684,17.348
33+
c2.996,4.489,4.98,12.278,5.755,17.382c0.007,0.048,0.013,0.096,0.02,0.144c0.072,0.484,0.129,0.972,0.178,1.46
34+
c0.036,0.365,0.069,0.729,0.093,1.097c0.012,0.177,0.021,0.354,0.03,0.531c0.026,0.538,0.046,1.077,0.046,1.621
35+
C273.414,208.155,242.242,226.295,203.75,226.356z M299.427,168.346c-3.504,1.367-6.977,0.139-7.757-2.744s1.428-6.328,4.932-7.695
36+
c3.504-1.367,6.977-0.139,7.757,2.744C305.139,163.534,302.931,166.979,299.427,168.346z'
37+
/>
38+
</g>
39+
</svg>
40+
</div>
41+
)
742
var dividItem = { name: '-' }
843
var menuBarItems = [
944
{
10-
name: (<div className="menu-bar-item-logo"></div>),
45+
name: codingLogo,
1146
className: 'coding-logo',
1247
items: [
1348
{

app/components/Modal/modals/Prompt.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Prompt extends Component {
2121
<div className='message'>{content.message}</div>
2222
: null }
2323
<input type='text'
24+
className='form-control'
2425
ref={r=>this.input=r}
2526
onChange={ e=>this.setState({value: e.target.value}) }
2627
onKeyDown={this.onKeyDown}

app/components/Package/extensionList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ExtensionList extends Component {
4949
<div>
5050
<input
5151
type="text"
52-
className="search"
52+
className="search form-control"
5353
value={this.state.searchKey}
5454
placeholder="filter extension by name"
5555
onChange={(e) => {

app/components/Setting/index.jsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ let SettingsView = (props) => {
139139
} = props
140140

141141
return (
142-
<div name="settings-view">
142+
<div className="settings-view">
143143
<div className="settings-container">
144144
<div className="settings-header">
145145
<div className="tab-bar-header">Settings</div>
@@ -158,15 +158,7 @@ let SettingsView = (props) => {
158158
</div>
159159
</div>
160160
</div>
161-
<div className="modal-ops" style={{
162-
position: 'relative',
163-
backgroundColor: 'white',
164-
paddingTop: '6px',
165-
paddingRight: '5px',
166-
borderTop: '1px solid #eee',
167-
marginLeft: '-10px',
168-
marginRight: '-10px'
169-
}}>
161+
<div className="modal-ops">
170162
<button
171163
className="btn btn-default"
172164
onClick={() => { cancelSettingItem(); }

app/components/Setting/reducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const getDefaultLangCode = () => {
3434
}, '')
3535
}
3636

37-
export const UIThemeOptions = ['Light', 'Dark']
37+
export const UIThemeOptions = ['base-theme', 'dark']
3838
export const SyntaxThemeOptions = ['default', 'neo', 'eclipse', 'monokai', 'material']
3939

4040
const SettingState = {

app/components/Terminal/index.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ terms.setActions(TabActions);
1313
class Term extends Component {
1414
constructor(props) {
1515
super(props);
16+
this.setTheme = this.setTheme.bind(this)
1617
}
1718

1819
componentDidMount() {
@@ -32,6 +33,7 @@ class Term extends Component {
3233
});
3334
setTimeout(() => terminal.sizeToFit(), 0)
3435
emitter.on(E.PANEL_RESIZED, this.onResize.bind(this))
36+
emitter.on(E.THEME_CHANGED, this.onTheme.bind(this))
3537

3638
terms.add(terminal);
3739
terminal.on('data', data => {
@@ -44,6 +46,7 @@ class Term extends Component {
4446

4547
componentWillUnmount() {
4648
emitter.removeListener(E.PANEL_RESIZED, this.onResize)
49+
emitter.removeListener(E.THEME_CHANGED, this.onTheme)
4750
}
4851

4952
render() {
@@ -61,12 +64,20 @@ class Term extends Component {
6164
this.terminal.sizeToFit()
6265
}
6366

67+
onTheme (nextThemeId) {
68+
let themeName = 'terminal_basic'
69+
if (nextThemeId === 'dark') {
70+
themeName = 'default'
71+
}
72+
this.setTheme(themeName)
73+
}
74+
6475
setTheme(themeName) {
65-
var theme = Terminal.themes.defaults['default'];
76+
var theme = Terminal.themes.defaults[themeName];
6677
var terminal = this.terminal;
6778
terminal.colors = Terminal.themes.colors(theme);
6879

69-
if (themeName == 'terminal_basic') terminal.colors[256] = '#fffff7';
80+
// if (themeName == 'terminal_basic') terminal.colors[256] = '#fffff7';
7081
terminal.element.style.backgroundColor = terminal.colors[256];
7182
terminal.element.style.color = terminal.colors[257];
7283
terminal.refresh(0, terminal.rows - 1)

app/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Root from './containers/Root'
66
import './styles/main.styl'
77
const baseTheme = require('!!style-loader/useable!css-loader!stylus-loader!./styles/base-theme/index.styl')
88
baseTheme.use()
9+
window.themes = { '@current': baseTheme }
910

1011
import initialize from './initialize'
1112

app/styles/base-theme/styles/menu.styl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@
1818
color: $text-color-subtle;
1919
}
2020
}
21+
22+
.menu-bar-item-logo {
23+
svg {
24+
fill: #353535;
25+
}
26+
}

app/styles/core-ui/Git.styl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
min-width: 200px;
8686
right: 1px;
8787
flex-direction: column;
88+
z-index: 201;
8889

8990
.widget-header {
9091
display: flex;

app/styles/core-ui/MenuBar.styl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727
.menu-bar-item-logo {
2828
width: 42px;
2929
height: 19px;
30-
background: url(https://dn-coding-net-production-static.qbox.me/static/cb75498a0ffd36e2c694da62f1bdb86c.svg) no-repeat center;
31-
background-size: 40px 34px;
30+
// background: url(https://dn-coding-net-production-static.qbox.me/static/cb75498a0ffd36e2c694da62f1bdb86c.svg) no-repeat center;
31+
// background-size: 40px 34px;
32+
svg {
33+
width: 40px;
34+
height: 34px;
35+
margin-top: -8px;
36+
}
3237
}
3338
.menu-bar-item-container {
3439
padding: 4px 12px;

0 commit comments

Comments
 (0)