mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-31 10:31:52 +00:00
Add dark theme and UI theme selector
This commit is contained in:
@@ -7,11 +7,25 @@ require('../styles/main/index.styl')
|
||||
import { openModal } from 'browser/lib/modal'
|
||||
import OSSAnnounceModal from './modal/OSSAnnounceModal'
|
||||
import activityRecord from 'browser/lib/activityRecord'
|
||||
import fetchConfig from '../lib/fetchConfig'
|
||||
const electron = require('electron')
|
||||
const ipc = electron.ipcRenderer
|
||||
const path = require('path')
|
||||
const remote = electron.remote
|
||||
|
||||
let config = fetchConfig()
|
||||
applyConfig(config)
|
||||
|
||||
ipc.on('config-apply', function (e, newConfig) {
|
||||
config = newConfig
|
||||
applyConfig(config)
|
||||
})
|
||||
|
||||
function applyConfig(config) {
|
||||
let body = document.body
|
||||
body.setAttribute('data-theme', config['theme-ui'])
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
window.addEventListener('keydown', function (e) {
|
||||
if (e.keyCode === 73 && e.metaKey && e.altKey) {
|
||||
|
||||
@@ -182,6 +182,13 @@ export default class AppSettingTab extends React.Component {
|
||||
: null
|
||||
}
|
||||
<div className='sectionTitle'>Theme</div>
|
||||
<div className='sectionSelect'>
|
||||
<label>UI Theme</label>
|
||||
<select valueLink={this.linkState('config.theme-ui')}>
|
||||
<option value='light'>Light</option>
|
||||
<option value='dark'>Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className='sectionSelect'>
|
||||
<label>Syntax Theme</label>
|
||||
<select valueLink={this.linkState('config.theme-syntax')}>
|
||||
|
||||
Reference in New Issue
Block a user