diff --git a/CHANGELOG.md b/CHANGELOG.md index cec1d9f56..2aa385e0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,6 @@ Web UI version numbers should always match the corresponding version of LBRY App * The "auth token" displayable on Help offers security warning * Added a new component for rendering dates and times. This component can render the date and time of a block height, as well. - ### Changed * * diff --git a/app/main.js b/app/main.js index b572eba82..4bc9944df 100644 --- a/app/main.js +++ b/app/main.js @@ -402,4 +402,4 @@ ipcMain.on('get-auth-token', (event) => { ipcMain.on('set-auth-token', (event, token) => { keytar.setPassword("LBRY", "auth_token", token ? token.toString().trim() : null); -}); \ No newline at end of file +}); diff --git a/app/package.json b/app/package.json index 2e4e70bd5..65d3f6ab5 100644 --- a/app/package.json +++ b/app/package.json @@ -24,4 +24,4 @@ "lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip" }, "license": "MIT" -} \ No newline at end of file +} diff --git a/ui/dist/quit.html b/ui/dist/quit.html index 161d7ab4c..eff68e049 100644 --- a/ui/dist/quit.html +++ b/ui/dist/quit.html @@ -6,7 +6,6 @@ - diff --git a/ui/dist/themes/dark.css b/ui/dist/themes/dark.css new file mode 100644 index 000000000..c32108393 --- /dev/null +++ b/ui/dist/themes/dark.css @@ -0,0 +1,46 @@ +:root { + /* Colors */ + --color-primary: #009688; + --color-canvas: #0f1517; + --color-bg: #1a2327; + --color-bg-alt: #314048; + --color-help: #AAA; + --color-error: #a94442; + --color-load-screen-text: #FFF; + --color-money: var(--color-primary); + --color-meta-light: #757575; + --color-dark-overlay: rgba(15, 21, 23, 0.85); + + /* Text */ + --text-color: #FFF; + --text-selection-bg: rgba(0,150,136, 0.95); + + /* Input */ + --input-bg: transparent; + --input-active-bg: rgba(0,0,0, 0.5); + --input-border-color: rgba(255,255,255, 0.25); + + /* Search */ + --search-bg: rgba(0,0,0, 0.45); + --search-color: #757575; + --search-active-bg: rgba(0,0,0, 0.75); + --search-border: 1px solid rgba(0,0,0, 0.25); + + /* Tab */ + --tab-color: #757575; + --tab-active-color: #CCC; + + /* Header */ + --header-color: #CCC; + --header-active-color: #FFF; + --header-button-bg: transparent; + + /* Table */ + --table-border: 0; + --table-item-even: var(--color-bg-alt); + --table-item-odd: transparent; + + /* Modla */ + --modal-overlay-bg: var(--color-dark-overlay); + --modal-border: 1px solid rgba(0, 0, 0, 0.25); +} diff --git a/ui/dist/themes/light.css b/ui/dist/themes/light.css new file mode 100644 index 000000000..c95f61136 --- /dev/null +++ b/ui/dist/themes/light.css @@ -0,0 +1,4 @@ +:root { + /* Colors */ + --color-primary: #155B4A; +} diff --git a/ui/js/actions/app.js b/ui/js/actions/app.js index 3d81d6c69..0f8a3bcf3 100644 --- a/ui/js/actions/app.js +++ b/ui/js/actions/app.js @@ -1,4 +1,5 @@ import * as types from "constants/action_types"; +import * as settings from "constants/settings"; import lbry from "lbry"; import { selectUpdateUrl, diff --git a/ui/js/actions/settings.js b/ui/js/actions/settings.js index 7038fd284..313b7c606 100644 --- a/ui/js/actions/settings.js +++ b/ui/js/actions/settings.js @@ -1,10 +1,16 @@ import * as types from "constants/action_types"; import * as settings from "constants/settings"; +import { doAlertError } from "actions/app"; import batchActions from "util/batchActions"; + import lbry from "lbry"; import fs from "fs"; import http from "http"; +const { remote } = require("electron"); +const { extname } = require("path"); +const { readdir } = remote.require("fs"); + export function doFetchDaemonSettings() { return function(dispatch, getState) { lbry.settings_get().then(settings => { @@ -46,6 +52,27 @@ export function doSetClientSetting(key, value) { }; } +export function doGetThemes() { + return function(dispatch, getState) { + const dir = `${remote.app.getAppPath()}/dist/themes`; + + readdir(dir, (error, files) => { + if (!error) { + dispatch( + doSetClientSetting( + settings.THEMES, + files + .filter(file => extname(file) === ".css") + .map(file => file.replace(".css", "")) + ) + ); + } else { + dispatch(doAlertError(error)); + } + }); + }; +} + export function doDownloadLanguage(langFile) { return function(dispatch, getState) { const destinationPath = `app/locales/${langFile}`; diff --git a/ui/js/component/app/view.jsx b/ui/js/component/app/view.jsx index e3c2465de..37bd05c72 100644 --- a/ui/js/component/app/view.jsx +++ b/ui/js/component/app/view.jsx @@ -1,6 +1,7 @@ import React from "react"; import Router from "component/router/index"; import Header from "component/header"; +import Theme from "component/theme"; import ModalRouter from "modal/modalRouter"; import lbry from "lbry"; @@ -49,6 +50,7 @@ class App extends React.PureComponent { render() { return (